Thread (4 messages) 4 messages, 2 authors, 2021-05-26

Re: [PATCH] media: s5p-g2d: Fix a memory leak on ctx->fh.m2m_ctx

From: Dillon Min <hidden>
Date: 2021-05-25 05:27:22
Also in: linux-media, lkml

Just a kind ping.

Thanks.
Dillon,

On Tue, May 11, 2021 at 12:09 PM [off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: Dillon Min <redacted>

The m2m_ctx resources was allocated by v4l2_m2m_ctx_init() in g2d_open()
should be freed from g2d_release() when it's not used.

Fix it

Fixes: 918847341af0 ("[media] v4l: add G2D driver for s5p device family")
Signed-off-by: Dillon Min <redacted>
---
 drivers/media/platform/s5p-g2d/g2d.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c
index 15bcb7f6e113..0818fdd3e984 100644
--- a/drivers/media/platform/s5p-g2d/g2d.c
+++ b/drivers/media/platform/s5p-g2d/g2d.c
@@ -279,6 +279,9 @@ static int g2d_release(struct file *file)
        v4l2_ctrl_handler_free(&ctx->ctrl_handler);
        v4l2_fh_del(&ctx->fh);
        v4l2_fh_exit(&ctx->fh);
+       mutex_lock(&dev->mutex);
+       v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
+       mutex_unlock(&dev->mutex);
        kfree(ctx);
        v4l2_info(&dev->v4l2_dev, "instance closed\n");
        return 0;
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help