Patch "net: libwx: fix memory leak in wx_setup_rx_resources" has been added to the 6.3-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

    net: libwx: fix memory leak in wx_setup_rx_resources

to the 6.3-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:
     net-libwx-fix-memory-leak-in-wx_setup_rx_resources.patch
and it can be found in the queue-6.3 subdirectory.

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



commit 72393fa189d53169c8db6d89b6139c098177b2fe
Author: Zhengchao Shao <shaozhengchao@xxxxxxxxxx>
Date:   Tue Apr 18 14:54:50 2023 +0800

    net: libwx: fix memory leak in wx_setup_rx_resources
    
    [ Upstream commit e315e7b83a22043bffee450437d7089ef373cbf6 ]
    
    When wx_alloc_page_pool() failed in wx_setup_rx_resources(), it doesn't
    release DMA buffer. Add dma_free_coherent() in the error path to release
    the DMA buffer.
    
    Fixes: 850b971110b2 ("net: libwx: Allocate Rx and Tx resources")
    Signed-off-by: Zhengchao Shao <shaozhengchao@xxxxxxxxxx>
    Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230418065450.2268522-1-shaozhengchao@xxxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.c b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
index eb89a274083e7..1e8d8b7b0c62e 100644
--- a/drivers/net/ethernet/wangxun/libwx/wx_lib.c
+++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
@@ -1798,10 +1798,13 @@ static int wx_setup_rx_resources(struct wx_ring *rx_ring)
 	ret = wx_alloc_page_pool(rx_ring);
 	if (ret < 0) {
 		dev_err(rx_ring->dev, "Page pool creation failed: %d\n", ret);
-		goto err;
+		goto err_desc;
 	}
 
 	return 0;
+
+err_desc:
+	dma_free_coherent(dev, rx_ring->size, rx_ring->desc, rx_ring->dma);
 err:
 	kvfree(rx_ring->rx_buffer_info);
 	rx_ring->rx_buffer_info = NULL;



[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