]> www.infradead.org Git - users/dwmw2/linux.git/commit
RDMA/qedr: Fix potential memory leak in __qedr_alloc_mr()
authorJianglei Nie <niejianglei2021@163.com>
Thu, 14 Jul 2022 06:15:05 +0000 (14:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2022 13:16:00 +0000 (15:16 +0200)
commit79ce50dddaf28b5c57911ecc80a2be17a0b17f83
tree3bea9a71b75ca75bc3508c0e1ae60f7fb92369de
parentaaa1a81506570ea24b63e36faf637d76a298be2e
RDMA/qedr: Fix potential memory leak in __qedr_alloc_mr()

[ Upstream commit b3236a64ddd125a455ef5b5316c1b9051b732974 ]

__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: e0290cce6ac0 ("qedr: Add support for memory registeration verbs")
Link: https://lore.kernel.org/r/20220714061505.2342759-1-niejianglei2021@163.com
Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
Acked-by: Michal KalderonĀ <michal.kalderon@marvell.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/qedr/verbs.c