Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] RDMA/cxgb4: Unmap BAR2 when c4iw_rdev_open() fails
@ 2026-11-22 13:54 Serhat Kumral
  2026-11-22 13:57 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Serhat Kumral @ 2026-11-22 13:54 UTC (permalink / raw)
  To: linux-rdma, Potnuri Bharat Teja
  Cc: Jason Gunthorpe, Leon Romanovsky, Roland Dreier, Steve Wise,
	linux-kernel, Serhat Kumral

c4iw_alloc() maps BAR2 on T5/T6 devices or its on-chip queue region
on T4 devices. If c4iw_rdev_open() fails, c4iw_alloc() releases the
IB device but leaves the mapping in place.

Unmap the mapped region before releasing the IB device.

Fixes: c6d7b26791a2 ("RDMA/cxgb4: Support on-chip SQs")
Fixes: fa658a98a2d0 ("RDMA/cxgb4: Use the BAR2/WC path for kernel QPs and T5 devices")
Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
---
 drivers/infiniband/hw/cxgb4/device.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index 24ac9871ce67..35dacf379294 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -1046,6 +1046,10 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop)
 	ret = c4iw_rdev_open(&devp->rdev);
 	if (ret) {
 		pr_err("Unable to open CXIO rdev err %d\n", ret);
+		if (devp->rdev.bar2_kva)
+			iounmap(devp->rdev.bar2_kva);
+		if (devp->rdev.oc_mw_kva)
+			iounmap(devp->rdev.oc_mw_kva);
 		ib_dealloc_device(&devp->ibdev);
 		return ERR_PTR(ret);
 	}
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-22 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 13:54 [PATCH] RDMA/cxgb4: Unmap BAR2 when c4iw_rdev_open() fails Serhat Kumral
2026-11-22 13:57 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox