[PATCH 6/8] drm: use priv->pid to deduce task EUID

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 3 18:58:55 UTC 2016


On Wed, Aug 03, 2016 at 08:04:30PM +0200, David Herrmann wrote:
> Rather than accessing priv->filp->f_cred, use priv->pid->task->creds. We
> want to get rid of "priv->filp", so lets avoid it if possible.
> 
> 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 at gmail.com>
> ---
>  drivers/gpu/drm/drm_info.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c
> index 247ba2b..1df2d33 100644
> --- a/drivers/gpu/drm/drm_info.c
> +++ b/drivers/gpu/drm/drm_info.c
> @@ -99,7 +99,7 @@ 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;
> +		uid = task ? __task_cred(task)->euid : GLOBAL_ROOT_UID;

Squash this into patch 2, so the poor reader doesn't have to learn about
f_cred.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the dri-devel mailing list