diff options
| author | Chris Wilson <[email protected]> | 2018-07-12 19:53:14 +0100 |
|---|---|---|
| committer | Chris Wilson <[email protected]> | 2018-07-13 16:15:38 +0100 |
| commit | f8c1cce36ccb21b5e5ecc87fac65de0e29693f01 (patch) | |
| tree | 282c622b8acc26f0409ae5bd32381668cff8fd94 | |
| parent | 3e977ac6179b39faa3c0eda5fce4f00663ae298d (diff) | |
drm/i915: Reject attempted pwrites into a read-only object
If the user created a read-only object, they should not be allowed to
circumvent the write protection using the pwrite ioctl.
Signed-off-by: Chris Wilson <[email protected]>
Cc: Jon Bloomfield <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Cc: Matthew Auld <[email protected]>
Reviewed-by: Jon Bloomfield <[email protected]>
Reviewed-by: Joonas Lahtinen <[email protected]>
Reviewed-by: Matthew Auld <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
| -rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 1910c66f48e2..42d24410a98c 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1627,6 +1627,12 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, goto err; } + /* Writes not allowed into this read-only object */ + if (i915_gem_object_is_readonly(obj)) { + ret = -EINVAL; + goto err; + } + trace_i915_gem_object_pwrite(obj, args->offset, args->size); ret = -ENODEV; |