Skip to content

Commit 3fc5410

Browse files
kaleshap86rleon
authored andcommitted
RDMA/bnxt_re: Fix a possible memory leak
In bnxt_re_setup_chip_ctx() when bnxt_qplib_map_db_bar() fails driver is not freeing the memory allocated for "rdev->chip_ctx". Fixes: 0ac20fa ("RDMA/bnxt_re: Reorg the bar mapping") Link: https://patch.msgid.link/r/1726715161-18941-2-git-send-email-selvin.xavier@broadcom.com Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 8cf0b93 commit 3fc5410

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • drivers/infiniband/hw/bnxt_re

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,11 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev)
188188

189189
bnxt_re_set_db_offset(rdev);
190190
rc = bnxt_qplib_map_db_bar(&rdev->qplib_res);
191-
if (rc)
191+
if (rc) {
192+
kfree(rdev->chip_ctx);
193+
rdev->chip_ctx = NULL;
192194
return rc;
195+
}
193196

194197
if (bnxt_qplib_determine_atomics(en_dev->pdev))
195198
ibdev_info(&rdev->ibdev,

0 commit comments

Comments
 (0)