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)
committerLeon Romanovsky <leonro@nvidia.com>
Mon, 18 Jul 2022 11:16:10 +0000 (14:16 +0300)
commitb3236a64ddd125a455ef5b5316c1b9051b732974
treea9dcab9a21f1dddfa4e8f13e377b53b82e698e68
parente39c600049d0822284da2cef3bd7ced40dc3524f
RDMA/qedr: Fix potential memory leak in __qedr_alloc_mr()

__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>
drivers/infiniband/hw/qedr/verbs.c