RDMA/rxe: Fix error paths in MR alloc routines
Subsystems (2)
PATCH v2 1/1 RDMA/rxe: Fix error paths in MR alloc routines
Currently the rxe driver has incorrect code in error paths for allocating MR objects. The PD and umem are always freed in rxe_mr_cleanup() but in some error paths they are already freed or never set. This patch makes sure that the PD is always set and checks to see if umem is set before freeing it in rxe_mr_cleanup(). umem and map sets are freed if an error occurs in an allocate mr call.
---
v2:
Moved setting mr->umem until after checks to avoid sending an ERR_PTR to ib_umem_release().
Cleaned up umem and map sets if errors occur in alloc mr calls. Rebased to current for-next.
drivers/infiniband/sw/rxe/rxe_loc.h | 6 +-- drivers/infiniband/sw/rxe/rxe_mr.c | 65 +++++++++++---------------- drivers/infiniband/sw/rxe/rxe_verbs.c | 43 +++++++----------- 3 files changed, 43 insertions(+), 71 deletions(-)
drivers/infiniband/sw/rxe/rxe_loc.h +3 -3
@@ -64,10 +64,10 @@ int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);/* rxe_mr.c */ u8 rxe_get_next_key (u32 last_key); -void rxe_mr_init_dma (struct rxe_pd *pd,int access,struct rxe_mr *mr); -int rxe_mr_init_user (struct rxe_pd *pd,u64 start,u64 length,u64 iova, +void rxe_mr_init_dma (int access,struct rxe_mr *mr); +int rxe_mr_init_user (struct rxe_dev *rxe,u64 start,u64 length,u64 iova,int access,struct rxe_mr *mr); -int rxe_mr_init_fast (struct rxe_pd *pd,int max_pages,struct rxe_mr *mr); +int rxe_mr_init_fast (int max_pages,struct rxe_mr *mr);int rxe_mr_copy (struct rxe_mr *mr,u64 iova,void *addr,int length,enum rxe_mr_copy_dir dir); int copy_data(struct rxe_pd *pd, int access, struct rxe_dma_info *dma,
drivers/infiniband/sw/rxe/rxe_mr.c +25 -40
145 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_verbs.c +15 -28
75 lines not on this page · raw message
base-commit: 0c6ab0ca9a662d4ca9742d97156bac0d3067d72d
Signature · 1 line
2.34.1
Jason Gunthorpe
maintainerQuoted 12 lines · Bob Pearson
Currently the rxe driver has incorrect code in error paths for allocating MR objects. The PD and umem are always freed in
rxe_mr_cleanup()but in some error paths they are already freed or never set. This patch makes sure that the PD is always set and checks to see if umem is set before freeing it inrxe_mr_cleanup(). umem and map sets are freed if an error occurs in an allocate mr call.Reported-by Li Zhijian <[email protected]>Fixes 3902b429ca14 ("Implement invalidate MW operations")Signed-off-by Bob Pearson <[email protected]>
Quoted 6 lines
---
v2:
Moved settingmr->umemuntil after checks to avoid sending anERR_PTRtoib_umem_release().
Cleaned up umem and map sets if errors occur in alloc mr calls. Rebased to current for-next.
It seems it doesn't apply now, can you resend on the next rc1?
Thanks,
Jason