All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] media: cedrus: fix reference leak in cedrus_start_streaming
@ 2020-11-02 14:26 Zhang Qilong
  2020-11-02 14:18 ` Maxime Ripard
  0 siblings, 1 reply; 7+ messages in thread
From: Zhang Qilong @ 2020-11-02 14:26 UTC (permalink / raw)
  To: mripard, paul.kocialkowski, mchehab, wens; +Cc: gregkh, linux-media, devel

pm_runtime_get_sync will increment pm usage counter even it
failed. Forgetting to pm_runtime_put_noidle will result in
reference leak in cedrus_start_streaming. We should fix it.

Fixes: d5aecd289babf ("media: cedrus: Implement runtime PM")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 drivers/staging/media/sunxi/cedrus/cedrus_video.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
index 667b86dde1ee..911f607d9b09 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
@@ -479,8 +479,10 @@ static int cedrus_start_streaming(struct vb2_queue *vq, unsigned int count)
 
 	if (V4L2_TYPE_IS_OUTPUT(vq->type)) {
 		ret = pm_runtime_get_sync(dev->dev);
-		if (ret < 0)
+		if (ret < 0) {
+			pm_runtime_put_noidle(dev->dev);
 			goto err_cleanup;
+		}
 
 		if (dev->dec_ops[ctx->current_codec]->start) {
 			ret = dev->dec_ops[ctx->current_codec]->start(ctx);
-- 
2.17.1


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

end of thread, other threads:[~2020-11-05 10:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-02 14:26 [PATCH -next] media: cedrus: fix reference leak in cedrus_start_streaming Zhang Qilong
2020-11-02 14:18 ` Maxime Ripard
2020-11-02 14:39   ` 答复: " zhangqilong
2020-11-02 15:12   ` Dan Carpenter
2020-11-04 11:39   ` Hans Verkuil
2020-11-05  8:06     ` 答复: " zhangqilong
2020-11-05 10:41     ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.