public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: fix task reference leak in i915_debugfs.c
@ 2015-09-25 10:58 Geliang Tang
  2015-09-25 11:16 ` Jani Nikula
  0 siblings, 1 reply; 3+ messages in thread
From: Geliang Tang @ 2015-09-25 10:58 UTC (permalink / raw)
  To: Daniel Vetter, Jani Nikula, David Airlie
  Cc: Geliang Tang, intel-gfx, dri-devel, linux-kernel

Leak a task reference in i915_ppgtt_info(), add put_task_struct()
to fix it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-25 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-25 10:58 [PATCH] drm/i915: fix task reference leak in i915_debugfs.c Geliang Tang
2015-09-25 11:16 ` Jani Nikula
2015-09-25 12:27   ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox