Patch "bnx2x: fix potential memory leak in bnx2x_tpa_stop()" has been added to the 6.0-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

    bnx2x: fix potential memory leak in bnx2x_tpa_stop()

to the 6.0-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:
     bnx2x-fix-potential-memory-leak-in-bnx2x_tpa_stop.patch
and it can be found in the queue-6.0 subdirectory.

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



commit b52b7af93fac5f4b00a41c49955b4d84b9a6f558
Author: Jianglei Nie <niejianglei2021@xxxxxxx>
Date:   Fri Sep 30 14:28:43 2022 +0800

    bnx2x: fix potential memory leak in bnx2x_tpa_stop()
    
    [ Upstream commit b43f9acbb8942b05252be83ac25a81cec70cc192 ]
    
    bnx2x_tpa_stop() allocates a memory chunk from new_data with
    bnx2x_frag_alloc(). The new_data should be freed when gets some error.
    But when "pad + len > fp->rx_buf_size" is true, bnx2x_tpa_stop() returns
    without releasing the new_data, which will lead to a memory leak.
    
    We should free the new_data with bnx2x_frag_free() when "pad + len >
    fp->rx_buf_size" is true.
    
    Fixes: 07b0f00964def8af9321cfd6c4a7e84f6362f728 ("bnx2x: fix possible panic under memory stress")
    Signed-off-by: Jianglei Nie <niejianglei2021@xxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 712b5595bc39..24bfc65e28e1 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -789,6 +789,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 			BNX2X_ERR("skb_put is about to fail...  pad %d  len %d  rx_buf_size %d\n",
 				  pad, len, fp->rx_buf_size);
 			bnx2x_panic();
+			bnx2x_frag_free(fp, new_data);
 			return;
 		}
 #endif



[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