drm/ttm: ttm object security fixes for render nodes
authorThomas Hellstrom <thellstrom@vmware.com>
Wed, 18 Dec 2013 13:13:29 +0000 (14:13 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Wed, 8 Jan 2014 09:11:57 +0000 (10:11 +0100)
commit05efb1abecce6e36457ae1a7be29ded7ac52292a
tree59be0d416b8811b273bc1b64f34fa4f0f4cb7b04
parent859ae233cd0ee76b6143f948ba1cb6b0b4c342f8
drm/ttm: ttm object security fixes for render nodes

When a client looks up a ttm object, don't look it up through the device hash
table, but rather from the file hash table. That makes sure that the client
has indeed put a reference on the object, or in gem terms, has opened
the object; either using prime or using the global "name".

To avoid a performance loss, make sure the file hash table entries can be
looked up from under an RCU lock, and as a consequence, replace the rwlock
with a spinlock, since we never need to take it in read mode only anymore.

Finally add a ttm object lookup function for the device hash table, that is
intended to be used when we put a ref object on a base object or, in  gem terms,
when we open the object.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
drivers/gpu/drm/ttm/ttm_object.c
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
include/drm/ttm/ttm_object.h