mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
bnxt: fix memory leak in bnxt_queue_mem_alloc error cases
There is a small memory leak in bnxt_queue_mem_alloc:
when bnxt_alloc_rx_agg_bmap() succeeds
but bnxt_alloc_one_tpa_info() later fails,
the rx_agg_bmap allocated by bnxt_alloc_rx_agg_bmap()
is not freed in the fallthrough cleanup cases.
Free the rx_agg_bmap in the err_free_rx_agg_ring case
and initialize clone->rx_agg_bmap = NULL earlier in the function
to allow for safe fallthrough.
Fixes: bd649c5cc9 ("bnxt_en: handle tpa_info in queue API implementation")
Signed-off-by: Will Chen <will.chen.tty@gmail.com>
Reviewed-by: Joe Damato <joe@dama.to>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20260729220132.1256924-1-will.chen.tty@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
d1ad8fb2ac
commit
d1000fd799
|
|
@ -16217,6 +16217,7 @@ static int bnxt_queue_mem_alloc(struct net_device *dev,
|
|||
clone->rx_next_cons = 0;
|
||||
clone->need_head_pool = false;
|
||||
clone->rx_page_size = qcfg->rx_page_size;
|
||||
clone->rx_agg_bmap = NULL;
|
||||
|
||||
rc = bnxt_alloc_rx_page_pool(bp, clone, rxr->page_pool->p.nid);
|
||||
if (rc)
|
||||
|
|
@ -16269,6 +16270,8 @@ static int bnxt_queue_mem_alloc(struct net_device *dev,
|
|||
bnxt_free_one_tpa_info(bp, clone);
|
||||
err_free_rx_agg_ring:
|
||||
bnxt_free_ring(bp, &clone->rx_agg_ring_struct.ring_mem);
|
||||
kfree(clone->rx_agg_bmap);
|
||||
clone->rx_agg_bmap = NULL;
|
||||
err_free_rx_ring:
|
||||
bnxt_free_ring(bp, &clone->rx_ring_struct.ring_mem);
|
||||
err_rxq_info_unreg:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user