summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorDillon Min <dillon.minfei@gmail.com>2021-05-26 18:18:32 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-06-17 11:21:51 +0300
commit5d11e6aad1811ea293ee2996cec9124f7fccb661 (patch)
treeef3b10b4220ac829d9c44c4e68b74d6d5b1fec8e /drivers/media
parent2b889a4afcacef4888ac8203a60e68004816e1fd (diff)
downloadlinux-5d11e6aad1811ea293ee2996cec9124f7fccb661.tar.xz
media: s5p-g2d: Fix a memory leak on ctx->fh.m2m_ctx
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 <dillon.minfei@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/s5p-g2d/g2d.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c
index 15bcb7f6e113..1cb5eaabf340 100644
--- a/drivers/media/platform/s5p-g2d/g2d.c
+++ b/drivers/media/platform/s5p-g2d/g2d.c
@@ -276,6 +276,9 @@ static int g2d_release(struct file *file)
struct g2d_dev *dev = video_drvdata(file);
struct g2d_ctx *ctx = fh2ctx(file->private_data);
+ mutex_lock(&dev->mutex);
+ v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
+ mutex_unlock(&dev->mutex);
v4l2_ctrl_handler_free(&ctx->ctrl_handler);
v4l2_fh_del(&ctx->fh);
v4l2_fh_exit(&ctx->fh);