summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2014-03-19 15:06:21 +0100
committerThomas Hellstrom <thellstrom@vmware.com>2014-03-28 14:19:04 +0100
commitf6dfe73abf3ae528b8c631d37739e6d61894c0b2 (patch)
tree78fc193a864eb8fbfad6330db6d60f33fb4a8ea9 /drivers/gpu/drm/vmwgfx
parent0d3215e3857ab679f74c9b26b7e711955c9d0438 (diff)
downloadop-kernel-dev-f6dfe73abf3ae528b8c631d37739e6d61894c0b2.zip
op-kernel-dev-f6dfe73abf3ae528b8c631d37739e6d61894c0b2.tar.gz
drm/vmwgfx: Tighten the security around buffer maps
Make sure only buffer objects that are referenced by the client can be mapped. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_resource.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index 30439cb..01d68f0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -538,8 +538,13 @@ int vmw_user_dmabuf_verify_access(struct ttm_buffer_object *bo,
return -EPERM;
vmw_user_bo = vmw_user_dma_buffer(bo);
- return (vmw_user_bo->prime.base.tfile == tfile ||
- vmw_user_bo->prime.base.shareable) ? 0 : -EPERM;
+
+ /* Check that the caller has opened the object. */
+ if (likely(ttm_ref_object_exists(tfile, &vmw_user_bo->prime.base)))
+ return 0;
+
+ DRM_ERROR("Could not grant buffer access.\n");
+ return -EPERM;
}
/**
OpenPOWER on IntegriCloud