Skip to content

Commit b43f9ac

Browse files
Jianglei Niedavem330
authored andcommitted
bnx2x: fix potential memory leak in bnx2x_tpa_stop()
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: 07b0f00 ("bnx2x: fix possible panic under memory stress") Signed-off-by: Jianglei Nie <niejianglei2021@163.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent cb4b120 commit b43f9ac

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
789789
BNX2X_ERR("skb_put is about to fail... pad %d len %d rx_buf_size %d\n",
790790
pad, len, fp->rx_buf_size);
791791
bnx2x_panic();
792+
bnx2x_frag_free(fp, new_data);
792793
return;
793794
}
794795
#endif

0 commit comments

Comments
 (0)