Skip to content

Commit 2ad8e57

Browse files
Michael Chankuba-moo
authored andcommitted
bnxt_en: Fix memory leak in bnxt_hwrm_get_rings()
bnxt_hwrm_get_rings() can abort and return error when there are not enough ring resources. It aborts without releasing the HWRM DMA buffer, causing a dma_pool_destroy warning when the driver is unloaded: bnxt_en 0000:99:00.0: dma_pool_destroy bnxt_hwrm, 000000005b089ba8 busy Fixes: f1e50b2 ("bnxt_en: Fix trimming of P5 RX and TX rings") Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://lore.kernel.org/r/20240117234515.226944-3-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 3c1069f commit 2ad8e57

File tree

1 file changed

+3
-2
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+3
-2
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6926,7 +6926,7 @@ static int bnxt_hwrm_get_rings(struct bnxt *bp)
69266926
if (cp < (rx + tx)) {
69276927
rc = __bnxt_trim_rings(bp, &rx, &tx, cp, false);
69286928
if (rc)
6929-
return rc;
6929+
goto get_rings_exit;
69306930
if (bp->flags & BNXT_FLAG_AGG_RINGS)
69316931
rx <<= 1;
69326932
hw_resc->resv_rx_rings = rx;
@@ -6938,8 +6938,9 @@ static int bnxt_hwrm_get_rings(struct bnxt *bp)
69386938
hw_resc->resv_cp_rings = cp;
69396939
hw_resc->resv_stat_ctxs = stats;
69406940
}
6941+
get_rings_exit:
69416942
hwrm_req_drop(bp, req);
6942-
return 0;
6943+
return rc;
69436944
}
69446945

69456946
int __bnxt_hwrm_get_tx_rings(struct bnxt *bp, u16 fid, int *tx_rings)

0 commit comments

Comments
 (0)