Skip to content

Commit

Permalink
drm/i915: fix task reference leak in i915_debugfs.c
Browse files Browse the repository at this point in the history
Leak a task reference in i915_ppgtt_info(), add put_task_struct()
to fix it.

Introduced by

commit 1c60fef
Author: Ben Widawsky <ben@bwidawsk.net>
Date:   Fri Dec 6 14:11:30 2013 -0800

    drm/i915: Dump all ppgtt

Signed-off-by: Geliang Tang <geliangtang@163.com>
[danvet: Add note provided by Jani about which commit introduced this
issue.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Geliang Tang authored and Daniel Vetter committed Sep 25, 2015
1 parent 7c4a7d6 commit 7cb5dff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/gpu/drm/i915/i915_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 7cb5dff

Please sign in to comment.