Re: [PATCH] drm/i915: fix task reference leak in i915_debugfs.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 25 Sep 2015, Geliang Tang <geliangtang@xxxxxxx> wrote:
> Leak a task reference in i915_ppgtt_info(), add put_task_struct()
> to fix it.

Introduced by

commit 1c60fef535d143860d5bf6593e24ab6417f5227c
Author: Ben Widawsky <ben@xxxxxxxxxxxx>
Date:   Fri Dec 6 14:11:30 2013 -0800

    drm/i915: Dump all ppgtt


>
> Signed-off-by: Geliang Tang <geliangtang@xxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 5615d3d..8797717 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2288,9 +2288,13 @@ static int i915_ppgtt_info(struct seq_file *m, void *data)
>  
>  	list_for_each_entry_reverse(file, &dev->filelist, lhead) {
>  		struct drm_i915_file_private *file_priv = file->driver_priv;
> +		struct task_struct *task;
>  
> -		seq_printf(m, "\nproc: %s\n",
> -			   get_pid_task(file->pid, PIDTYPE_PID)->comm);
> +		task = get_pid_task(file->pid, PIDTYPE_PID);
> +		if (!task)
> +			return -ESRCH;
> +		seq_printf(m, "\nproc: %s\n", task->comm);
> +		put_task_struct(task);
>  		idr_for_each(&file_priv->context_idr, per_file_ctx,
>  			     (void *)(unsigned long)m);
>  	}
> -- 
> 1.9.1
>
>

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux