RDMA/bnxt_re: Fix a possible memory leak
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Thu, 18 May 2023 08:10:59 +0000 (01:10 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2023 08:33:59 +0000 (10:33 +0200)
commitdcaa61b73d9c89364e6f1e0bec44866b1c02c276
tree854744358f8d0f6912c25176e961944d3a233f4f
parent44fc5eb0e2674b5c934f105d89533e03d064e9c1
RDMA/bnxt_re: Fix a possible memory leak

[ Upstream commit 349e3c0cf239cc01d58a1e6c749e171de014cd6a ]

Inside bnxt_qplib_create_cq(), when the check for NULL DPI fails, driver
returns directly without freeing the memory allocated inside
bnxt_qplib_alloc_init_hwq() routine.

Fixed this by moving the check for NULL DPI before invoking
bnxt_qplib_alloc_init_hwq().

Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
Link: https://lore.kernel.org/r/1684397461-23082-2-git-send-email-selvin.xavier@broadcom.com
Reviewed-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/bnxt_re/qplib_fp.c