Patch "ethernet: atheros: fix a memleak in atl1e_setup_ring_resources" has been added to the 5.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

    ethernet: atheros: fix a memleak in atl1e_setup_ring_resources

to the 5.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:
     ethernet-atheros-fix-a-memleak-in-atl1e_setup_ring_r.patch
and it can be found in the queue-5.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 ff64dbe466eceb5053be53bd57834bcc0dc56c25
Author: Zhipeng Lu <alexious@xxxxxxxxxx>
Date:   Thu Dec 14 21:04:04 2023 +0800

    ethernet: atheros: fix a memleak in atl1e_setup_ring_resources
    
    [ Upstream commit 309fdb1c33fe726d92d0030481346f24e1b01f07 ]
    
    In the error handling of 'offset > adapter->ring_size', the
    tx_ring->tx_buffer allocated by kzalloc should be freed,
    instead of 'goto failed' instantly.
    
    Fixes: a6a5325239c2 ("atl1e: Atheros L1E Gigabit Ethernet driver")
    Signed-off-by: Zhipeng Lu <alexious@xxxxxxxxxx>
    Reviewed-by: Suman Ghosh <sumang@xxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index 6bdd79a057190..171f4ffcd869b 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -868,10 +868,13 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
 		netdev_err(adapter->netdev, "offset(%d) > ring size(%d) !!\n",
 			   offset, adapter->ring_size);
 		err = -1;
-		goto failed;
+		goto free_buffer;
 	}
 
 	return 0;
+free_buffer:
+	kfree(tx_ring->tx_buffer);
+	tx_ring->tx_buffer = NULL;
 failed:
 	if (adapter->ring_vir_addr != NULL) {
 		pci_free_consistent(pdev, adapter->ring_size,




[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