Skip to content

Commit

Permalink
drm/i915/userptr: reject zero user_size
Browse files Browse the repository at this point in the history
Operating on a zero sized GEM userptr object will lead to explosions.

Fixes: 5cc9ed4 ("drm/i915: Introduce mapping of user pages into video memory (userptr) ioctl")
Testcase: igt/gem_userptr_blits/input-checking
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180502195021.30900-1-matthew.auld@intel.com
(cherry picked from commit c11c7bf)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
  • Loading branch information
Matthew Auld authored and Joonas Lahtinen committed May 14, 2018
1 parent 67b8d5c commit 20943f9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/i915/i915_gem_userptr.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,9 @@ i915_gem_userptr_ioctl(struct drm_device *dev,
I915_USERPTR_UNSYNCHRONIZED))
return -EINVAL;

if (!args->user_size)
return -EINVAL;

if (offset_in_page(args->user_ptr | args->user_size))
return -EINVAL;

Expand Down

0 comments on commit 20943f9

Please sign in to comment.