linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/vc4: fix ref count leak in vc4_v3d_pm_get
@ 2020-06-14  6:56 Navid Emamdoost
  0 siblings, 0 replies; only message in thread
From: Navid Emamdoost @ 2020-06-14  6:56 UTC (permalink / raw)
  To: Eric Anholt, David Airlie, Daniel Vetter, dri-devel, linux-kernel
  Cc: emamd001, wu000273, kjlu, smccaman, Navid Emamdoost

in vc4_v3d_pm_get, the call to pm_runtime_get_sync increments the
counter even in case of failure, leading to incorrect
ref count. In case of failure, decrement the ref count before returning.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/gpu/drm/vc4/vc4_v3d.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index cea77a21b205..bb03c1d1bb4d 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -135,6 +135,7 @@ vc4_v3d_pm_get(struct vc4_dev *vc4)
 
 		if (ret < 0) {
 			vc4->power_refcount--;
+			pm_runtime_put(&vc4->v3d->pdev->dev);
 			mutex_unlock(&vc4->power_lock);
 			return ret;
 		}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-14  6:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-14  6:56 [PATCH] drm/vc4: fix ref count leak in vc4_v3d_pm_get Navid Emamdoost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).