Commit c3844d5a authored by Jianglei Nie's avatar Jianglei Nie Committed by Yongqiang Liu
Browse files

bnx2x: fix potential memory leak in bnx2x_tpa_stop()

mainline inclusion
from mainline-v6.1-rc1
commit b43f9acb
category: bugfix
bugzilla: 187839, https://gitee.com/src-openeuler/kernel/issues/I5W7B1


CVE: CVE-2022-3542

--------------------------------

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: 07b0f009 ("bnx2x: fix possible panic under memory stress")
Signed-off-by: default avatarJianglei Nie <niejianglei2021@163.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarRen Zhijie <renzhijie2@huawei.com>
Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: default avatarChen Hui <judy.chenhui@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 4302727a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment