Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH RESEND rdma-next 1/2] RDMA/irdma: Do not allow rereg_mr to revive defunct MRs
@ 2026-10-29 14:18 Jacob Moroni
  2026-10-29 14:18 ` [PATCH RESEND rdma-next 2/2] RDMA/irdma: Do not change mr->pd in driver during rereg_mr Jacob Moroni
  2026-10-29 14:31 ` [PATCH RESEND rdma-next 1/2] RDMA/irdma: Do not allow rereg_mr to revive defunct MRs sashiko-bot
  0 siblings, 2 replies; 4+ messages in thread
From: Jacob Moroni @ 2026-10-29 14:18 UTC (permalink / raw)
  To: tatyana.e.nikolova, jgg, leon; +Cc: linux-rdma, Jacob Moroni

An MR can become "defunct" if a previous rereg_mr happened
to fail in between deregistering the old MR in HW and
reregistering it (e.g., due to ib_umem_get_va() failing
in the IB_MR_REREG_TRANS case).

In this case, the MR is left in a state where the umem may
have already been released.

If rereg_mr then runs again, but without IB_MR_REREG_TRANS,
it will end up reregistering the MR with stale translation
info.

Fix this by rejecting any attempt to reregister an MR that
has previously failed during rereg_mr after the point where
the MR has been deregistered in HW.

Fixes: 5ac388db27c4 ("RDMA/irdma: Add support to re-register a memory region")
Signed-off-by: Jacob Moroni <jmoroni@google.com>
---
 drivers/infiniband/hw/irdma/verbs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index c91c55917de9..fd1b1454f026 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -3873,6 +3873,9 @@ static struct ib_mr *irdma_rereg_user_mr(struct ib_mr *ib_mr, int flags,
 	if (ret)
 		return ERR_PTR(ret);
 
+	if (!iwmr->is_hwreg)
+		return ERR_PTR(-EINVAL);
+
 	ret = irdma_hwdereg_mr(ib_mr);
 	if (ret)
 		return ERR_PTR(ret);

base-commit: c3e8e9451e6f1b69f685b75e0fbf14f3d0fb2539
prerequisite-patch-id: 6e527df00a7bd3c3941ab1af65ab5d7115264bb6
-- 
2.56.0.313.g2479322e68-goog


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

end of thread, other threads:[~2026-10-29 14:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 14:18 [PATCH RESEND rdma-next 1/2] RDMA/irdma: Do not allow rereg_mr to revive defunct MRs Jacob Moroni
2026-10-29 14:18 ` [PATCH RESEND rdma-next 2/2] RDMA/irdma: Do not change mr->pd in driver during rereg_mr Jacob Moroni
2026-10-29 14:37   ` sashiko-bot
2026-10-29 14:31 ` [PATCH RESEND rdma-next 1/2] RDMA/irdma: Do not allow rereg_mr to revive defunct MRs sashiko-bot

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