Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3cb01a98 authored by David Herrmann's avatar David Herrmann
Browse files

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: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
parent 48ba8137
Loading
Loading
Loading
Loading
+2 −11
Original line number Original line Diff line number Diff line
@@ -199,8 +199,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
	priv->minor = minor;
	priv->minor = minor;


	/* for compatibility root is always authenticated */
	/* for compatibility root is always authenticated */
	priv->always_authenticated = capable(CAP_SYS_ADMIN);
	priv->authenticated = capable(CAP_SYS_ADMIN);
	priv->authenticated = priv->always_authenticated;
	priv->lock_count = 0;
	priv->lock_count = 0;


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


	if (drm_is_master(file_priv)) {
	if (drm_is_master(file_priv)) {
		struct drm_master *master = file_priv->master;
		struct drm_master *master = file_priv->master;
		struct drm_file *temp;

		mutex_lock(&dev->struct_mutex);
		list_for_each_entry(temp, &dev->filelist, lhead) {
			if ((temp->master == file_priv->master) &&
			    (temp != file_priv))
				temp->authenticated = temp->always_authenticated;
		}


		/**
		/**
		 * Since the master is disappearing, so is the
		 * Since the master is disappearing, so is the
		 * possibility to lock.
		 * possibility to lock.
		 */
		 */

		mutex_lock(&dev->struct_mutex);
		if (master->lock.hw_lock) {
		if (master->lock.hw_lock) {
			if (dev->sigdata.lock == master->lock.hw_lock)
			if (dev->sigdata.lock == master->lock.hw_lock)
				dev->sigdata.lock = NULL;
				dev->sigdata.lock = NULL;
+0 −1
Original line number Original line Diff line number Diff line
@@ -385,7 +385,6 @@ struct drm_prime_file_private {


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