This is a note to let you know that I've just added the patch titled Revert "media: ti: cal: fix possible memory leak in cal_ctx_create()" to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-media-ti-cal-fix-possible-memory-leak-in-cal_ctx_create.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From cuigaosheng1@xxxxxxxxxx Tue Apr 11 16:17:00 2023 From: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx> Date: Tue, 4 Apr 2023 09:25:02 +0800 Subject: Revert "media: ti: cal: fix possible memory leak in cal_ctx_create()" To: <stable@xxxxxxxxxxxxxxx>, <cuigaosheng1@xxxxxxxxxx> Cc: <bparrot@xxxxxx>, <mchehab@xxxxxxxxxx>, <sashal@xxxxxxxxxx>, <laurent.pinchart@xxxxxxxxxxxxxxxx>, <gregkh@xxxxxxxxxxxxxxxxxxx>, <patches@xxxxxxxxxxxxxxx> Message-ID: <20230404012502.3061129-1-cuigaosheng1@xxxxxxxxxx> From: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx> 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@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/media/platform/ti-vpe/cal.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- 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(st ctx->cport = inst; ret = cal_ctx_v4l2_init(ctx); - if (ret) { - kfree(ctx); + if (ret) return NULL; - } return ctx; } Patches currently in stable-queue which might be from cuigaosheng1@xxxxxxxxxx are queue-5.10/revert-media-ti-cal-fix-possible-memory-leak-in-cal_ctx_create.patch