* [PATCH] RDMA/irdma: Initialize iwmr->access during MR registration
@ 2026-06-04 15:41 Jacob Moroni
2026-06-05 17:14 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Jacob Moroni @ 2026-06-04 15:41 UTC (permalink / raw)
To: tatyana.e.nikolova, jgg, leon; +Cc: linux-rdma, Jacob Moroni
Initialize iwmr->access during initial user mem registration so
that it contains a valid value during a subsequent rereg_mr.
Otherwise, a rereg_mr that doesn't set IB_MR_REREG_ACCESS (for
example, one that only changes the PD) ends up clearing the
access flags in HW since iwmr->access is zero-initialized, which
is not intended.
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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index baee48df5fd..f2f487e9540 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -3309,6 +3309,7 @@ static int irdma_reg_user_mr_type_mem(struct irdma_mr *iwmr, int access,
int err;
lvl = iwmr->page_cnt != 1 ? PBLE_LEVEL_1 | PBLE_LEVEL_2 : PBLE_LEVEL_0;
+ iwmr->access = access;
err = irdma_setup_pbles(iwdev->rf, iwmr, lvl);
if (err)
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] RDMA/irdma: Initialize iwmr->access during MR registration
2026-06-04 15:41 [PATCH] RDMA/irdma: Initialize iwmr->access during MR registration Jacob Moroni
@ 2026-06-05 17:14 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2026-06-05 17:14 UTC (permalink / raw)
To: Jacob Moroni; +Cc: tatyana.e.nikolova, leon, linux-rdma
On Thu, Jun 04, 2026 at 03:41:04PM +0000, Jacob Moroni wrote:
> Initialize iwmr->access during initial user mem registration so
> that it contains a valid value during a subsequent rereg_mr.
>
> Otherwise, a rereg_mr that doesn't set IB_MR_REREG_ACCESS (for
> example, one that only changes the PD) ends up clearing the
> access flags in HW since iwmr->access is zero-initialized, which
> is not intended.
>
> 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 | 1 +
> 1 file changed, 1 insertion(+)
Applied to for-next
Still more preexisting Sashiko issues:
https://sashiko.dev/#/patchset/20260604154104.4035581-1-jmoroni%40google.com
This one sounds bad:
This is a pre-existing issue, but could this sequence allow arbitrary
physical memory access when an MR re-registration fails?
Sigh, rereg_mr is a trainwreck in every driver.
I fixed mlx5 a long time ago, there is a new flow now for rereg where
the driver can create a new mr from scratch and return that. irdma
should do that for any destructive change like replacing the
umem. Otherwise it is impossible to get the error semantics correct.
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-05 17:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 15:41 [PATCH] RDMA/irdma: Initialize iwmr->access during MR registration Jacob Moroni
2026-06-05 17:14 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox