mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 01:49:36 +00:00
drm: Do not drop root privileges for a fancier younger process
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 <chris@chris-wilson.co.uk> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
33e3fd5567
commit
1020dc6990
2 changed files with 4 additions and 2 deletions
|
@ -239,7 +239,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
|
||||||
|
|
||||||
priv->ioctl_count = 0;
|
priv->ioctl_count = 0;
|
||||||
/* for compatibility root is always authenticated */
|
/* 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;
|
priv->lock_count = 0;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&priv->lhead);
|
INIT_LIST_HEAD(&priv->lhead);
|
||||||
|
@ -533,7 +534,7 @@ int drm_release(struct inode *inode, struct file *filp)
|
||||||
list_for_each_entry(temp, &dev->filelist, lhead) {
|
list_for_each_entry(temp, &dev->filelist, lhead) {
|
||||||
if ((temp->master == file_priv->master) &&
|
if ((temp->master == file_priv->master) &&
|
||||||
(temp != file_priv))
|
(temp != file_priv))
|
||||||
temp->authenticated = 0;
|
temp->authenticated = temp->always_authenticated;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -413,6 +413,7 @@ struct drm_prime_file_private {
|
||||||
|
|
||||||
/** File private data */
|
/** File private data */
|
||||||
struct drm_file {
|
struct drm_file {
|
||||||
|
int always_authenticated;
|
||||||
int authenticated;
|
int authenticated;
|
||||||
struct pid *pid;
|
struct pid *pid;
|
||||||
kuid_t uid;
|
kuid_t uid;
|
||||||
|
|
Loading…
Reference in a new issue