Commit 8c99e57d authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Treat using a purged buffer as a source of EFAULT

Since a purged buffer is one without any associated pages, attempting to
use it should generate EFAULT rather than EINVAL, as it is not strictly
an invalid parameter.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 45d67817
...@@ -1619,7 +1619,7 @@ i915_gem_mmap_gtt(struct drm_file *file, ...@@ -1619,7 +1619,7 @@ i915_gem_mmap_gtt(struct drm_file *file,
if (obj->madv != I915_MADV_WILLNEED) { if (obj->madv != I915_MADV_WILLNEED) {
DRM_ERROR("Attempting to mmap a purgeable buffer\n"); DRM_ERROR("Attempting to mmap a purgeable buffer\n");
ret = -EINVAL; ret = -EFAULT;
goto out; goto out;
} }
...@@ -1973,7 +1973,7 @@ i915_gem_object_get_pages(struct drm_i915_gem_object *obj) ...@@ -1973,7 +1973,7 @@ i915_gem_object_get_pages(struct drm_i915_gem_object *obj)
if (obj->madv != I915_MADV_WILLNEED) { if (obj->madv != I915_MADV_WILLNEED) {
DRM_ERROR("Attempting to obtain a purgeable object\n"); DRM_ERROR("Attempting to obtain a purgeable object\n");
return -EINVAL; return -EFAULT;
} }
BUG_ON(obj->pages_pin_count); BUG_ON(obj->pages_pin_count);
...@@ -3917,7 +3917,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data, ...@@ -3917,7 +3917,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
if (obj->madv != I915_MADV_WILLNEED) { if (obj->madv != I915_MADV_WILLNEED) {
DRM_ERROR("Attempting to pin a purgeable buffer\n"); DRM_ERROR("Attempting to pin a purgeable buffer\n");
ret = -EINVAL; ret = -EFAULT;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment