Skip to content

Commit 3cb01a9

Browse files
author
David Herrmann
committed
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>
1 parent 48ba813 commit 3cb01a9

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

‎drivers/gpu/drm/drm_fops.c‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
199199
priv->minor = minor;
200200

201201
/* for compatibility root is always authenticated */
202-
priv->always_authenticated = capable(CAP_SYS_ADMIN);
203-
priv->authenticated = priv->always_authenticated;
202+
priv->authenticated = capable(CAP_SYS_ADMIN);
204203
priv->lock_count = 0;
205204

206205
INIT_LIST_HEAD(&priv->lhead);
@@ -462,20 +461,12 @@ int drm_release(struct inode *inode, struct file *filp)
462461

463462
if (drm_is_master(file_priv)) {
464463
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-
}
473464

474465
/**
475466
* Since the master is disappearing, so is the
476467
* possibility to lock.
477468
*/
478-
469+
mutex_lock(&dev->struct_mutex);
479470
if (master->lock.hw_lock) {
480471
if (dev->sigdata.lock == master->lock.hw_lock)
481472
dev->sigdata.lock = NULL;

‎include/drm/drmP.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ struct drm_prime_file_private {
385385

386386
/** File private data */
387387
struct drm_file {
388-
unsigned always_authenticated :1;
389388
unsigned authenticated :1;
390389
/* true when the client has asked us to expose stereo 3D mode flags */
391390
unsigned stereo_allowed :1;

0 commit comments

Comments
 (0)