Patch "media: cx231xx: fix a memleak in cx231xx_init_isoc" has been added to the 6.6-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: cx231xx: fix a memleak in cx231xx_init_isoc

to the 6.6-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-cx231xx-fix-a-memleak-in-cx231xx_init_isoc.patch
and it can be found in the queue-6.6 subdirectory.

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



commit de0dfbe312b620818ea87c85d1ba72022715b06d
Author: Zhipeng Lu <alexious@xxxxxxxxxx>
Date:   Fri Dec 1 21:22:55 2023 +0800

    media: cx231xx: fix a memleak in cx231xx_init_isoc
    
    [ Upstream commit 5d3c8990e2bbf929cb211563dadd70708f42e4e6 ]
    
    The dma_q->p_left_data alloced by kzalloc should be freed in all the
    following error handling paths. However, it hasn't been freed in the
    allocation error paths of dev->video_mode.isoc_ctl.urb and
    dev->video_mode.isoc_ctl.transfer_buffer.
    
    On the other hand, the dma_q->p_left_data did be freed in the
    error-handling paths after that of dev->video_mode.isoc_ctl.urb and
    dev->video_mode.isoc_ctl.transfer_buffer, by calling
    cx231xx_uninit_isoc(dev). So the same free operation should be done in
    error-handling paths of those two allocation.
    
    Fixes: 64fbf4445526 ("[media] cx231xx: Added support for Carraera, Shelby, RDx_253S and VIDEO_GRABBER")
    Signed-off-by: Zhipeng Lu <alexious@xxxxxxxxxx>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c
index 727e6268567f..f1feccc28bf0 100644
--- a/drivers/media/usb/cx231xx/cx231xx-core.c
+++ b/drivers/media/usb/cx231xx/cx231xx-core.c
@@ -1024,6 +1024,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
 	if (!dev->video_mode.isoc_ctl.urb) {
 		dev_err(dev->dev,
 			"cannot alloc memory for usb buffers\n");
+		kfree(dma_q->p_left_data);
 		return -ENOMEM;
 	}
 
@@ -1033,6 +1034,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
 		dev_err(dev->dev,
 			"cannot allocate memory for usbtransfer\n");
 		kfree(dev->video_mode.isoc_ctl.urb);
+		kfree(dma_q->p_left_data);
 		return -ENOMEM;
 	}
 




[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