Skip to content

Commit 1abe186

Browse files
monis410jgunthorpe
authored andcommitted
IB/mlx5: Reset access mask when looping inside page fault handler
If page-fault handler spans multiple MRs then the access mask needs to be reset before each MR handling or otherwise write access will be granted to mapped pages instead of read-only. Cc: <[email protected]> # 3.19 Fixes: 7bdf65d ("IB/mlx5: Handle page faults") Reported-by: Jerome Glisse <[email protected]> Signed-off-by: Moni Shoua <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent d029434 commit 1abe186

File tree

1 file changed

+2
-1
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+2
-1
lines changed

drivers/infiniband/hw/mlx5/odp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ static int pagefault_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr,
585585
struct ib_umem_odp *odp_mr = to_ib_umem_odp(mr->umem);
586586
bool downgrade = flags & MLX5_PF_FLAGS_DOWNGRADE;
587587
bool prefetch = flags & MLX5_PF_FLAGS_PREFETCH;
588-
u64 access_mask = ODP_READ_ALLOWED_BIT;
588+
u64 access_mask;
589589
u64 start_idx, page_mask;
590590
struct ib_umem_odp *odp;
591591
size_t size;
@@ -607,6 +607,7 @@ static int pagefault_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr,
607607
page_shift = mr->umem->page_shift;
608608
page_mask = ~(BIT(page_shift) - 1);
609609
start_idx = (io_virt - (mr->mmkey.iova & page_mask)) >> page_shift;
610+
access_mask = ODP_READ_ALLOWED_BIT;
610611

611612
if (prefetch && !downgrade && !mr->umem->writable) {
612613
/* prefetch with write-access must

0 commit comments

Comments
 (0)