RDMA/irdma: Initialize iwmr->access during MR registration
Subsystems (2)
PATCH 1/1 RDMA/irdma: Initialize iwmr->access during MR registration
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.
--- drivers/infiniband/hw/irdma/verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/irdma/verbs.c +1 -0
@@ -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)
Signature · 1 line
2.54.0.1032.g2f8565e1d1-goog
Quoted 8 lines · Jacob Moroni
Initialize
iwmr->accessduring initial user mem registration so that it contains a valid value during a subsequentrereg_mr.Otherwise, a
rereg_mrthat doesn't setIB_MR_REREG_ACCESS(for example, one that only changes the PD) ends up clearing the access flags in HW sinceiwmr->accessis zero-initialized, which is not intended.
Quoted 5 lines
Fixes 5ac388db27c4 ("RDMA/irdma: Add support to re-register a memory region")Signed-off-by Jacob Moroni <[email protected]>--- 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