aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 17b1cba3b5f1..bc4164590054 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3630,8 +3630,15 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec,
3630 3630
3631 for (i = 0; i < count; i++) { 3631 for (i = 0; i < count; i++) {
3632 char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; 3632 char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr;
3633 size_t length = exec[i].relocation_count * sizeof(struct drm_i915_gem_relocation_entry); 3633 int length; /* limited by fault_in_pages_readable() */
3634 3634
3635 /* First check for malicious input causing overflow */
3636 if (exec[i].relocation_count >
3637 INT_MAX / sizeof(struct drm_i915_gem_relocation_entry))
3638 return -EINVAL;
3639
3640 length = exec[i].relocation_count *
3641 sizeof(struct drm_i915_gem_relocation_entry);
3635 if (!access_ok(VERIFY_READ, ptr, length)) 3642 if (!access_ok(VERIFY_READ, ptr, length))
3636 return -EFAULT; 3643 return -EFAULT;
3637 3644