drm/i915: unlock on error in i915_ppgtt_info()
diff mbox

Message ID 20151002151422.GA6049@mwanda
State New
Headers show

Commit Message

Dan Carpenter Oct. 2, 2015, 3:14 p.m. UTC
We need to call intel_runtime_pm_put() and mutex_unlock() before
returning.

Fixes: 7cb5dff8d59d ('drm/i915: fix task reference leak in i915_debugfs.c')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Geliang Tang Oct. 2, 2015, 3:29 p.m. UTC | #1
On Fri, Oct 02, 2015 at 06:14:22PM +0300, Dan Carpenter wrote:
> We need to call intel_runtime_pm_put() and mutex_unlock() before
> returning.
> 
> Fixes: 7cb5dff8d59d ('drm/i915: fix task reference leak in i915_debugfs.c')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Geliang Tang <geliangtang@163.com>
Daniel Vetter Oct. 5, 2015, 8:01 a.m. UTC | #2
On Fri, Oct 02, 2015 at 11:29:16PM +0800, Geliang Tang wrote:
> On Fri, Oct 02, 2015 at 06:14:22PM +0300, Dan Carpenter wrote:
> > We need to call intel_runtime_pm_put() and mutex_unlock() before
> > returning.
> > 
> > Fixes: 7cb5dff8d59d ('drm/i915: fix task reference leak in i915_debugfs.c')
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Acked-by: Geliang Tang <geliangtang@163.com>

Queued for -next, thanks for the patch.
-Daniel

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index afa7982..dcc50f3 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2294,18 +2294,21 @@  static int i915_ppgtt_info(struct seq_file *m, void *data)
 		struct task_struct *task;
 
 		task = get_pid_task(file->pid, PIDTYPE_PID);
-		if (!task)
-			return -ESRCH;
+		if (!task) {
+			ret = -ESRCH;
+			goto out_put;
+		}
 		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);
 	}
 
+out_put:
 	intel_runtime_pm_put(dev_priv);
 	mutex_unlock(&dev->struct_mutex);
 
-	return 0;
+	return ret;
 }
 
 static int count_irq_waiters(struct drm_i915_private *i915)