]> git.baikalelectronics.ru Git - kernel.git/commit
bnx2x: fix potential memory leak in bnx2x_tpa_stop()
authorJianglei Nie <niejianglei2021@163.com>
Fri, 30 Sep 2022 06:28:43 +0000 (14:28 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Oct 2022 11:41:07 +0000 (12:41 +0100)
commit74566b14b9aa9b3f0ce7172358f8b6531d51b269
treec0b5665dc5e96ac6fcc6ed7a9ee835b7d141c1e5
parent48d0bc95a465488e1262e2cb32844f8b07903734
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: ab406322156501e0d5b80d50445ab59c64db717c ("bnx2x: fix possible panic under memory stress")
Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c