summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2018-05-02 20:50:21 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-05-08 12:24:39 +0100
commitc11c7bfd213495784b22ef82a69b6489f8d0092f (patch)
tree4da8be6f3997f7a8d2db60050136bfcdcfb77527 /drivers/gpu
parenta02eb975be78171f66a47c103e57e7940d0860a7 (diff)
downloadop-kernel-dev-c11c7bfd213495784b22ef82a69b6489f8d0092f.zip
op-kernel-dev-c11c7bfd213495784b22ef82a69b6489f8d0092f.tar.gz
drm/i915/userptr: reject zero user_size
Operating on a zero sized GEM userptr object will lead to explosions. Fixes: 5cc9ed4b9a7a ("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
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_userptr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index d596a83..854bd51 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -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;
OpenPOWER on IntegriCloud