bnge: Fix resource leak in bnge_init_nic() error path
PATCH 1/1 bnge: Fix resource leak in bnge_init_nic() error path
If bnge_init_chip() fails, bnge_init_nic() jumps to err_free_ring_grps and returns immediately, skipping cleanup for RX ring pair buffers.
Remove the early return so execution falls through to err_free_rx_ring_pair_bufs to properly free resources on error.
--- drivers/net/ethernet/broadcom/bnge/bnge_netdev.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/broadcom/bnge/bnge_netdev.c +0 -2
@@ -2820,8 +2820,6 @@ static int bnge_init_nic(struct bnge_net *bn) err_free_ring_grps:bnge_free_ring_grps (bn); -return rc; - err_free_rx_ring_pair_bufs:bnge_free_rx_ring_pair_bufs (bn);return rc;
Signature · 1 line
2.47.3
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 6 lines · On Wed, 5 Aug 2026 15:10:22 +0530 you wrote:
If
bnge_init_chip()fails,bnge_init_nic()jumps toerr_free_ring_grpsand returns immediately, skipping cleanup for RX ring pair buffers.Remove the early return so execution falls through to
err_free_rx_ring_pair_bufsto properly free resources on error.
Quoted 6 lines
Fixes 23df6aebf803 ("bng_en: Allocate stat contexts")Signed-off-by Bhargava Marreddy <[email protected]>Reviewed-by Dharmender Garg <[email protected]>Reviewed-by Rajashekar Hudumula <[email protected]>[...]
Here is the summary with links:
- [net] bnge: Fix resource leak in bnge_init_nic() error path
https://git.kernel.org/netdev/net/c/bfec39ff1484
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html