summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-09-22 18:46:17 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-09-23 01:10:39 +0100
commitab18282d58ce67ee5cd720d99a91c1a2bbf3e693 (patch)
treec6463246f1c90f93dfee5b309645c7627fd8cc0e /drivers/gpu
parentbb6baf76f45708dbba651ed76a7ad94462f30c0b (diff)
downloadtalos-op-linux-ab18282d58ce67ee5cd720d99a91c1a2bbf3e693.tar.gz
talos-op-linux-ab18282d58ce67ee5cd720d99a91c1a2bbf3e693.zip
drm/i915: Warn before mmaping a purgeable buffer.
Only allow the user to mmap buffers that have not been marked as purgeable. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index f4f714e39b7b..4755ba41bfef 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1431,6 +1431,14 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
obj_priv = obj->driver_private;
+ if (obj_priv->madv != I915_MADV_WILLNEED) {
+ DRM_ERROR("Attempting to mmap a purgeable buffer\n");
+ drm_gem_object_unreference(obj);
+ mutex_unlock(&dev->struct_mutex);
+ return -EINVAL;
+ }
+
+
if (!obj_priv->mmap_offset) {
ret = i915_gem_create_mmap_offset(obj);
if (ret) {
OpenPOWER on IntegriCloud