drm: Fix an unwanted master inheritance v2
authorThomas Hellstrom <thellstrom@vmware.com>
Wed, 2 Dec 2015 17:24:46 +0000 (09:24 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 30 Dec 2015 02:26:00 +0000 (02:26 +0000)
commitc627716e77d4cef0f8b689a72168e033495606ba
treefb1d66d6bbc18cfb71be4c444c76a9e566d0cd2e
parent377ace8bdcb36a3961b894f20090d8fae1197872
drm: Fix an unwanted master inheritance v2

commit a0af2e538c80f3e47f1d6ddf120a153ad909e8ad upstream.

A client calling drmSetMaster() using a file descriptor that was opened
when another client was master would inherit the latter client's master
object and all its authenticated clients.

This is unwanted behaviour, and when this happens, instead allocate a
brand new master object for the client calling drmSetMaster().

Fixes a BUG() throw in vmw_master_set().

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
[bwh: Backported to 3.2:
 - s/master_mutex/struct_mutex/
 - drm_new_set_master() must drop struct_mutex while calling
   drm_driver::master_create
 - Adjust filename, context, indentation]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/gpu/drm/drm_fops.c
drivers/gpu/drm/drm_stub.c
include/drm/drmP.h