* [PATCH] RDMA/ocrdma: Free the local key when MR continuation fails
@ 2026-11-30 7:11 Wanhui Fu
2026-11-30 7:18 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Wanhui Fu @ 2026-11-30 7:11 UTC (permalink / raw)
To: selvin.xavier, jgg, leon, parav.pandit, roland; +Cc: linux-rdma, Wanhui Fu
ocrdma_mbx_reg_mr() allocates a local key and stores it in
hwmr->lkey. If ocrdma_mbx_reg_mr_cont() fails, this key is
required to be released to prevent a resource leak.
Fix it by calling ocrdma_mbx_dealloc_lkey on error path.
Found it by a self-developed static analysis tool and
compile-test passed.
Fixes: fe2caefcdf58 ("RDMA/ocrdma: Add driver for Emulex OneConnect IBoE RDMA adapter")
Signed-off-by: Wanhui Fu <fuwh1120@163.com>
---
drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 006ef2e6b5f3..09734fa6c017 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -2068,8 +2068,10 @@ int ocrdma_reg_mr(struct ocrdma_dev *dev,
if (status)
break;
}
- if (status)
+ if (status) {
pr_err("%s() err. status=%d\n", __func__, status);
+ ocrdma_mbx_dealloc_lkey(dev, hwmr->fr_mr, hwmr->lkey);
+ }
return status;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-30 7:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 7:11 [PATCH] RDMA/ocrdma: Free the local key when MR continuation fails Wanhui Fu
2026-11-30 7:18 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox