[Intel-gfx] [PATCH v2] drm/i915: Reject invalid-pad for context-destroy and -create ioctls

Daniel Vetter daniel at ffwll.ch
Mon Feb 15 17:02:38 UTC 2016


On Fri, Feb 05, 2016 at 04:45:59PM +0000, Chris Wilson wrote:
> 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 <chris at chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem_context.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 54af654d04d6..c75d3468f29a 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -972,6 +972,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;
> @@ -995,6 +998,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;
>  
> -- 
> 2.7.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list