Patch "media: ti: cal: fix possible memory leak in cal_ctx_create()" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    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:
     media-ti-cal-fix-possible-memory-leak-in-cal_ctx_cre.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.



commit 6bba50c4a4de1a26763a5b52473a00aaacbd0d72
Author: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
Date:   Tue Nov 29 12:01:59 2022 +0100

    media: ti: cal: fix possible memory leak in cal_ctx_create()
    
    [ Upstream commit 7acd650a0484d92985a0d6d867d980c6dd019885 ]
    
    The memory of ctx is allocated in cal_ctx_create(), but it will
    not be freed when cal_ctx_v4l2_init() fails, so add kfree() when
    cal_ctx_v4l2_init() fails to fix it.
    
    Fixes: d68a94e98a89 ("media: ti-vpe: cal: Split video device initialization and registration")
    Signed-off-by: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
    Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index 2eef245c31a17..93121c90d76ae 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -624,8 +624,10 @@ static struct cal_ctx *cal_ctx_create(struct cal_dev *cal, int inst)
 	ctx->cport = inst;
 
 	ret = cal_ctx_v4l2_init(ctx);
-	if (ret)
+	if (ret) {
+		kfree(ctx);
 		return NULL;
+	}
 
 	return ctx;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux