Patch "media: mediatek: vcodec: fix resource leaks in vdec_msg_queue_init()" has been added to the 6.4-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: mediatek: vcodec: fix resource leaks in vdec_msg_queue_init()

to the 6.4-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-mediatek-vcodec-fix-resource-leaks-in-vdec_msg.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e10ed0daaff13e57d612167880e789c65771506b
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Wed Jun 14 16:06:47 2023 +0300

    media: mediatek: vcodec: fix resource leaks in vdec_msg_queue_init()
    
    [ Upstream commit cf10b0bb503c974ba049d6f888b21178be20a962 ]
    
    If we encounter any error in the vdec_msg_queue_init() then we need
    to set "msg_queue->wdma_addr.size = 0;".  Normally, this is done
    inside the vdec_msg_queue_deinit() function.  However, if the
    first call to allocate &msg_queue->wdma_addr fails, then the
    vdec_msg_queue_deinit() function is a no-op.  For that situation, just
    set the size to zero explicitly and return.
    
    There were two other error paths which did not clean up before returning.
    Change those error paths to goto mem_alloc_err.
    
    Fixes: b199fe46f35c ("media: mtk-vcodec: Add msg queue feature for lat and core architecture")
    Fixes: 2f5d0aef37c6 ("media: mediatek: vcodec: support stateless AV1 decoder")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Reviewed-by: Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c
index 675f62814f94e..a81212c0ade9d 100644
--- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c
+++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c
@@ -313,6 +313,7 @@ int vdec_msg_queue_init(struct vdec_msg_queue *msg_queue,
 	err = mtk_vcodec_mem_alloc(ctx, &msg_queue->wdma_addr);
 	if (err) {
 		mtk_v4l2_err("failed to allocate wdma_addr buf");
+		msg_queue->wdma_addr.size = 0;
 		return -ENOMEM;
 	}
 	msg_queue->wdma_rptr_addr = msg_queue->wdma_addr.dma_addr;



[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