Patch "dmaengine: imx-sdma: Fix a possible memory leak in sdma_transfer_init" has been added to the 6.1-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

    dmaengine: imx-sdma: Fix a possible memory leak in sdma_transfer_init

to the 6.1-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:
     dmaengine-imx-sdma-fix-a-possible-memory-leak-in-sdm.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 0763bb815fd78c0baf937c0f3a583350ec64312c
Author: Hui Wang <hui.wang@xxxxxxxxxxxxx>
Date:   Wed Nov 30 17:08:00 2022 +0800

    dmaengine: imx-sdma: Fix a possible memory leak in sdma_transfer_init
    
    [ Upstream commit 1417f59ac0b02130ee56c0c50794b9b257be3d17 ]
    
    If the function sdma_load_context() fails, the sdma_desc will be
    freed, but the allocated desc->bd is forgot to be freed.
    
    We already met the sdma_load_context() failure case and the log as
    below:
    [ 450.699064] imx-sdma 30bd0000.dma-controller: Timeout waiting for CH0 ready
    ...
    
    In this case, the desc->bd will not be freed without this change.
    
    Signed-off-by: Hui Wang <hui.wang@xxxxxxxxxxxxx>
    Reviewed-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221130090800.102035-1-hui.wang@xxxxxxxxxxxxx
    Signed-off-by: Vinod Koul <vkoul@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index fbea5f62dd98..b926abe4fa43 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1521,10 +1521,12 @@ static struct sdma_desc *sdma_transfer_init(struct sdma_channel *sdmac,
 		sdma_config_ownership(sdmac, false, true, false);
 
 	if (sdma_load_context(sdmac))
-		goto err_desc_out;
+		goto err_bd_out;
 
 	return desc;
 
+err_bd_out:
+	sdma_free_bd(desc);
 err_desc_out:
 	kfree(desc);
 err_out:



[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