From: jsg Date: Thu, 13 Sep 2018 03:45:08 +0000 (+0000) Subject: drm/i915/userptr: reject zero user_size X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=096956bbcbb060f26f462fcfcf14bf673cf89be8;p=openbsd drm/i915/userptr: reject zero user_size From Matthew Auld 182e963432d867384f2e55487ec60ca7a9f99cd1 in linux 4.4.y/4.4.155 c11c7bfd213495784b22ef82a69b6489f8d0092f in mainline linux --- diff --git a/sys/dev/pci/drm/i915/i915_gem_userptr.c b/sys/dev/pci/drm/i915/i915_gem_userptr.c index cfef42c2bf0..781419bed4b 100644 --- a/sys/dev/pci/drm/i915/i915_gem_userptr.c +++ b/sys/dev/pci/drm/i915/i915_gem_userptr.c @@ -846,6 +846,9 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file I915_USERPTR_UNSYNCHRONIZED)) return -EINVAL; + if (!args->user_size) + return -EINVAL; + if (offset_in_page(args->user_ptr | args->user_size)) return -EINVAL;