drm/i915: Reject invalid-pad for context-destroy and -create ioctls
authorChris Wilson <[email protected]>
Fri, 5 Feb 2016 16:45:59 +0000 (16:45 +0000)
committerDaniel Vetter <[email protected]>
Mon, 15 Feb 2016 17:26:52 +0000 (18:26 +0100)
Unknown parameters, especially structure padding, are expected to invoke
rejection with -EINVAL.

v2: similar issue exists for context-create

Testcase: igt/gem_ctx_create/invalid-pad
Testcase: igt/gem_ctx_bad_destroy/invalid-pad
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89602
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93999
Signed-off-by: Chris Wilson <[email protected]>
Cc: Daniel Vetter <[email protected]>
Reviewed-by: Daniel Vetter <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/i915/i915_gem_context.c

index 83a097c94911935f85129a15789ca03d5912d61e..4be2ce917f54e8f9d6ad7ff48feaa11bf2158b30 100644 (file)
@@ -855,6 +855,9 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
        if (!contexts_enabled(dev))
                return -ENODEV;
 
+       if (args->pad != 0)
+               return -EINVAL;
+
        ret = i915_mutex_lock_interruptible(dev);
        if (ret)
                return ret;
@@ -878,6 +881,9 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
        struct intel_context *ctx;
        int ret;
 
+       if (args->pad != 0)
+               return -EINVAL;
+
        if (args->ctx_id == DEFAULT_CONTEXT_HANDLE)
                return -ENOENT;