diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2021-06-11 21:59:05 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2024-01-08 14:01:49 +0100 |
commit | 4ecd7c697206a152f2e9a9f900f299b18cfbc705 (patch) | |
tree | 81df41cceea4c012eae2c40095a5bb7c2de56b39 /drivers | |
parent | 4587f1482eeb54fb0c7f2092da0440d3912c939c (diff) |
drm/i915/eb: Report EFAULT when writing updated exec_obj offset
This was thrown out in
commit 2889caa9232109afc8881f29a2205abeb5709d0c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Fri Jun 16 15:05:19 2017 +0100
drm/i915: Eliminate lots of iterations over the execobjects array
with the justification that we're already past the point of no return
(in a comment, not in the commit message).
That's true, but also if userspace is silly and hands us read-only
memory, then we'll only notice that when we write to it. So reporting
the error is still our duty, not that it's likely - at this point
we're dealing with nasty userspace anyway.
Also this is what we've been doing for around 8 years before this
patch changed it.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jon Bloomfield <jon.bloomfield@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c index 3753b9661f32..9f8c32c93d82 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c @@ -3590,16 +3590,11 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data, err = i915_gem_do_execbuffer(dev, file, args, exec2_list); - /* - * Now that we have begun execution of the batchbuffer, we ignore - * any new error after this point. Also given that we have already - * updated the associated relocations, we try to write out the current - * object locations irrespective of any error. - */ if (args->flags & __EXEC_HAS_RELOC) { struct drm_i915_gem_exec_object2 __user *user_exec_list = u64_to_user_ptr(args->buffers_ptr); unsigned int i; + bool failed = true; /* Copy the new buffer offsets back to the user's exec list. */ /* @@ -3623,9 +3618,12 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data, &user_exec_list[i].offset, end_user); } + failed = false; end_user: user_write_access_end(); -end:; +end: + if (failed) + err = -EFAULT; } args->flags &= ~__I915_EXEC_UNKNOWN_FLAGS; |