Commit 84d86ed9 authored by Jianglei Nie's avatar Jianglei Nie Committed by Zheng Zengkai
Browse files

RDMA/qedr: Fix potential memory leak in __qedr_alloc_mr()

stable inclusion
from stable-v5.10.137
commit 79ce50dddaf28b5c57911ecc80a2be17a0b17f83
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=79ce50dddaf28b5c57911ecc80a2be17a0b17f83

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

[ Upstream commit b3236a64 ]

__qedr_alloc_mr() allocates a memory chunk for "mr->info.pbl_table" with
init_mr_info(). When rdma_alloc_tid() and rdma_register_tid() fail, "mr"
is released while "mr->info.pbl_table" is not released, which will lead
to a memory leak.

We should release the "mr->info.pbl_table" with qedr_free_pbl() when error
occurs to fix the memory leak.

Fixes: e0290cce ("qedr: Add support for memory registeration verbs")
Link: https://lore.kernel.org/r/20220714061505.2342759-1-niejianglei2021@163.com


Signed-off-by: default avatarJianglei Nie <niejianglei2021@163.com>
Acked-by: default avatarMichal <Kalderon &lt;michal.kalderon@marvell.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: default avatarWei Li <liwei391@huawei.com>
parent 27a1aec5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment