aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6e85496f9164..5041ebe3fdf9 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3399,6 +3399,15 @@ i915_gem_execbuffer_relocate(struct drm_i915_gem_object *obj,
3399 iowrite32(reloc.delta, reloc_entry); 3399 iowrite32(reloc.delta, reloc_entry);
3400 io_mapping_unmap_atomic(reloc_page, KM_USER0); 3400 io_mapping_unmap_atomic(reloc_page, KM_USER0);
3401 } 3401 }
3402
3403 /* and update the user's relocation entry */
3404 reloc.presumed_offset = target_offset;
3405 if (__copy_to_user_inatomic(&user_relocs[i].presumed_offset,
3406 &reloc.presumed_offset,
3407 sizeof(reloc.presumed_offset))) {
3408 ret = -EFAULT;
3409 break;
3410 }
3402 } 3411 }
3403 3412
3404 drm_gem_object_unreference(target_obj); 3413 drm_gem_object_unreference(target_obj);
@@ -3560,6 +3569,10 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec,
3560 if (!access_ok(VERIFY_READ, ptr, length)) 3569 if (!access_ok(VERIFY_READ, ptr, length))
3561 return -EFAULT; 3570 return -EFAULT;
3562 3571
3572 /* we may also need to update the presumed offsets */
3573 if (!access_ok(VERIFY_WRITE, ptr, length))
3574 return -EFAULT;
3575
3563 if (fault_in_pages_readable(ptr, length)) 3576 if (fault_in_pages_readable(ptr, length))
3564 return -EFAULT; 3577 return -EFAULT;
3565 } 3578 }