summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaosheng Cui <cuigaosheng1@huawei.com>2023-04-04 04:25:02 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-20 13:10:24 +0300
commita412ba6b6cc643991f154fa2799aafb957b5fc9e (patch)
tree9803d4027e224e7397fa6c0a1240fbb6eb4c35db
parent2d96c8dca9467b60f93bf3ac72a6588cc438ac1e (diff)
downloadlinux-a412ba6b6cc643991f154fa2799aafb957b5fc9e.tar.xz
Revert "media: ti: cal: fix possible memory leak in cal_ctx_create()"
This reverts commit c7a218cbf67fffcd99b76ae3b5e9c2e8bef17c8c. The memory of ctx is allocated by devm_kzalloc in cal_ctx_create, it should not be freed by kfree when cal_ctx_v4l2_init() fails, otherwise kfree() will cause double free, so revert this patch. The memory of ctx is allocated by kzalloc since commit 9e67f24e4d9 ("media: ti-vpe: cal: fix ctx uninitialization"), so the fixes tag of patch c7a218cbf67fis not entirely accurate, mainline should merge this patch, but it should not be merged into 5.10, so we just revert this patch for this branch. Fixes: c7a218cbf67f ("media: ti: cal: fix possible memory leak in cal_ctx_create()") Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/media/platform/ti-vpe/cal.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index 93121c90d76a..2eef245c31a1 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -624,10 +624,8 @@ static struct cal_ctx *cal_ctx_create(struct cal_dev *cal, int inst)
ctx->cport = inst;
ret = cal_ctx_v4l2_init(ctx);
- if (ret) {
- kfree(ctx);
+ if (ret)
return NULL;
- }
return ctx;
}