aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-07-22 11:12:26 -0400
committerDavid Herrmann <dh.herrmann@gmail.com>2014-08-05 10:07:55 -0400
commit3cb01a980461506f9ec4e4e1dc2dab6314236fb7 (patch)
treee35eb24679bda6f69a1f216ba33522b603262dc7
parent48ba813701eb14b3008edefef4a0789b328e278c (diff)
drm: don't de-authenticate clients on master-close
If an active DRM-Master closes its device, we deauthenticate all clients on that master. However, if an inactive DRM-Master closes its device, we do nothing. This is quite inconsistent and breaks several scenarios: 1) If this was used as security mechanism, it fails horribly if a master closes a device while VT switched away. Furthermore, none of the few drivers using ->master_*() callbacks seems to require it, anyway. 2) If you spawn weston (or any other non-UMS compositor) in background while another compositor is active, both will get assigned to the same "drm_master" object. If the foreground compositor now exits, all clients of both the foreground AND background compositor will be de-authenticated leading to unexpected behavior. Stop this non-sense and keep clients authenticated. We don't do this when dropping DRM-Master (i.e., switching VTs) so don't do it on active-close either! Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--drivers/gpu/drm/drm_fops.c13
-rw-r--r--include/drm/drmP.h1
2 files changed, 2 insertions, 12 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 53435e07fa8d..3299175da6ac 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -199,8 +199,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
199 priv->minor = minor; 199 priv->minor = minor;
200 200
201 /* for compatibility root is always authenticated */ 201 /* for compatibility root is always authenticated */
202 priv->always_authenticated = capable(CAP_SYS_ADMIN); 202 priv->authenticated = capable(CAP_SYS_ADMIN);
203 priv->authenticated = priv->always_authenticated;
204 priv->lock_count = 0; 203 priv->lock_count = 0;
205 204
206 INIT_LIST_HEAD(&priv->lhead); 205 INIT_LIST_HEAD(&priv->lhead);
@@ -462,20 +461,12 @@ int drm_release(struct inode *inode, struct file *filp)
462 461
463 if (drm_is_master(file_priv)) { 462 if (drm_is_master(file_priv)) {
464 struct drm_master *master = file_priv->master; 463 struct drm_master *master = file_priv->master;
465 struct drm_file *temp;
466
467 mutex_lock(&dev->struct_mutex);
468 list_for_each_entry(temp, &dev->filelist, lhead) {
469 if ((temp->master == file_priv->master) &&
470 (temp != file_priv))
471 temp->authenticated = temp->always_authenticated;
472 }
473 464
474 /** 465 /**
475 * Since the master is disappearing, so is the 466 * Since the master is disappearing, so is the
476 * possibility to lock. 467 * possibility to lock.
477 */ 468 */
478 469 mutex_lock(&dev->struct_mutex);
479 if (master->lock.hw_lock) { 470 if (master->lock.hw_lock) {
480 if (dev->sigdata.lock == master->lock.hw_lock) 471 if (dev->sigdata.lock == master->lock.hw_lock)
481 dev->sigdata.lock = NULL; 472 dev->sigdata.lock = NULL;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 6ede53712d7b..e67058cc527e 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -385,7 +385,6 @@ struct drm_prime_file_private {
385 385
386/** File private data */ 386/** File private data */
387struct drm_file { 387struct drm_file {
388 unsigned always_authenticated :1;
389 unsigned authenticated :1; 388 unsigned authenticated :1;
390 /* true when the client has asked us to expose stereo 3D mode flags */ 389 /* true when the client has asked us to expose stereo 3D mode flags */
391 unsigned stereo_allowed :1; 390 unsigned stereo_allowed :1;