Skip to content

Commit

Permalink
drm: Do not drop root privileges for a fancier younger process
Browse files Browse the repository at this point in the history
When a second process opens the device and master transferrence is
complete, we walk the list of open devices and remove their
authentication. This also revokes our root privilege. Instead of simply
dropping the authentication, this patch reverts the authenticated state
back to its original value.

Signed-off-by: Chris Wilson <[email protected]>
Reviewed-by: David Herrmann <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
  • Loading branch information
ickle authored and airlied committed Nov 6, 2013
1 parent 33e3fd5 commit 1020dc6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/gpu/drm/drm_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,

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

INIT_LIST_HEAD(&priv->lhead);
Expand Down Expand Up @@ -533,7 +534,7 @@ int drm_release(struct inode *inode, struct file *filp)
list_for_each_entry(temp, &dev->filelist, lhead) {
if ((temp->master == file_priv->master) &&
(temp != file_priv))
temp->authenticated = 0;
temp->authenticated = temp->always_authenticated;
}

/**
Expand Down
1 change: 1 addition & 0 deletions include/drm/drmP.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ struct drm_prime_file_private {

/** File private data */
struct drm_file {
int always_authenticated;
int authenticated;
struct pid *pid;
kuid_t uid;
Expand Down

0 comments on commit 1020dc6

Please sign in to comment.