drm/i915/userptr: reject zero user_size
authorjsg <jsg@openbsd.org>
Thu, 13 Sep 2018 03:45:08 +0000 (03:45 +0000)
committerjsg <jsg@openbsd.org>
Thu, 13 Sep 2018 03:45:08 +0000 (03:45 +0000)
From Matthew Auld
182e963432d867384f2e55487ec60ca7a9f99cd1 in linux 4.4.y/4.4.155
c11c7bfd213495784b22ef82a69b6489f8d0092f in mainline linux

sys/dev/pci/drm/i915/i915_gem_userptr.c

index cfef42c..781419b 100644 (file)
@@ -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;