[PATCH 2/8] drm: remove redundant drm_file->uid

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 3 19:01:00 UTC 2016


On Wed, Aug 03, 2016 at 08:04:26PM +0200, David Herrmann wrote:
> @@ -98,13 +99,14 @@ int drm_clients_info(struct seq_file *m, void *data)
>  
>  		rcu_read_lock(); /* locks pid_task()->comm */
>  		task = pid_task(priv->pid, PIDTYPE_PID);
> +		uid = priv->filp ? priv->filp->f_cred->euid : GLOBAL_ROOT_UID;
>  		seq_printf(m, "%20s %5d %3d   %c    %c %5d %10u\n",
>  			   task ? task->comm : "<unknown>",
>  			   pid_vnr(priv->pid),
>  			   priv->minor->index,
>  			   drm_is_current_master(priv) ? '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);
>  		rcu_read_unlock();
>  	}
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 33af4a5..49cd835 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -191,7 +191,9 @@ static int drm_getclient(struct drm_device *dev, void *data,
>  		client->auth = file_priv->authenticated;
>  		client->pid = pid_vnr(file_priv->pid);
>  		client->uid = from_kuid_munged(current_user_ns(),
> -					       file_priv->uid);
> +					       file_priv->filp ?
> +					       file_priv->filp->f_cred->euid :
> +					       GLOBAL_ROOT_UID);

Why can't we use task_euid(pid_task(file_priv->pid)) here as well?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the dri-devel mailing list