drm: remove redundant drm_file->uid
Each DRM file-context caches the EUID of the process that opened the file. It is used exclusively for debugging purposes in /proc/dri/ and friends. Note, however, that we can already fetch the EUID from priv->pid->task->creds. The pointer-chasing will not hurt us, since it is only about debugging, anyway. Since we already are in an rcu-read-side, we can use __task_cred() rather than task_cred_xxx(). Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20160901124837.680-2-dh.herrmann@gmail.com
This commit is contained in:
parent
9f8cf165c6
commit
75ae95a75d
|
@ -199,7 +199,6 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
|
||||||
|
|
||||||
filp->private_data = priv;
|
filp->private_data = priv;
|
||||||
priv->filp = filp;
|
priv->filp = filp;
|
||||||
priv->uid = current_euid();
|
|
||||||
priv->pid = get_pid(task_pid(current));
|
priv->pid = get_pid(task_pid(current));
|
||||||
priv->minor = minor;
|
priv->minor = minor;
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ int drm_clients_info(struct seq_file *m, void *data)
|
||||||
struct drm_info_node *node = (struct drm_info_node *) m->private;
|
struct drm_info_node *node = (struct drm_info_node *) m->private;
|
||||||
struct drm_device *dev = node->minor->dev;
|
struct drm_device *dev = node->minor->dev;
|
||||||
struct drm_file *priv;
|
struct drm_file *priv;
|
||||||
|
kuid_t uid;
|
||||||
|
|
||||||
seq_printf(m,
|
seq_printf(m,
|
||||||
"%20s %5s %3s master a %5s %10s\n",
|
"%20s %5s %3s master a %5s %10s\n",
|
||||||
|
@ -98,13 +99,14 @@ int drm_clients_info(struct seq_file *m, void *data)
|
||||||
|
|
||||||
rcu_read_lock(); /* locks pid_task()->comm */
|
rcu_read_lock(); /* locks pid_task()->comm */
|
||||||
task = pid_task(priv->pid, PIDTYPE_PID);
|
task = pid_task(priv->pid, PIDTYPE_PID);
|
||||||
|
uid = task ? __task_cred(task)->euid : GLOBAL_ROOT_UID;
|
||||||
seq_printf(m, "%20s %5d %3d %c %c %5d %10u\n",
|
seq_printf(m, "%20s %5d %3d %c %c %5d %10u\n",
|
||||||
task ? task->comm : "<unknown>",
|
task ? task->comm : "<unknown>",
|
||||||
pid_vnr(priv->pid),
|
pid_vnr(priv->pid),
|
||||||
priv->minor->index,
|
priv->minor->index,
|
||||||
drm_is_current_master(priv) ? 'y' : 'n',
|
drm_is_current_master(priv) ? 'y' : 'n',
|
||||||
priv->authenticated ? 'y' : 'n',
|
priv->authenticated ? 'y' : 'n',
|
||||||
from_kuid_munged(seq_user_ns(m), priv->uid),
|
from_kuid_munged(seq_user_ns(m), uid),
|
||||||
priv->magic);
|
priv->magic);
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,7 +379,6 @@ struct drm_file {
|
||||||
unsigned is_master:1;
|
unsigned is_master:1;
|
||||||
|
|
||||||
struct pid *pid;
|
struct pid *pid;
|
||||||
kuid_t uid;
|
|
||||||
drm_magic_t magic;
|
drm_magic_t magic;
|
||||||
struct list_head lhead;
|
struct list_head lhead;
|
||||||
struct drm_minor *minor;
|
struct drm_minor *minor;
|
||||||
|
|
Loading…
Reference in New Issue