Skip to content

Commit 9ec4483

Browse files
yishaihjgunthorpe
authored andcommitted
IB/mlx5: Move MRs to a kernel PD when freeing them to the MR cache
Fix unreg_umr to move the MR to a kernel owned PD (i.e. the UMR PD) which can't be accessed by userspace. This ensures that nothing can continue to access the MR once it has been placed in the kernels cache for reuse. MRs in the cache continue to have their HW state, including DMA tables, present. Even though the MR has been invalidated, changing the PD provides an additional layer of protection against use of the MR. Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> # 3.10 Fixes: e126ba9 ("mlx5: Add driver for Mellanox Connect-IB adapters") Signed-off-by: Yishai Hadas <[email protected]> Reviewed-by: Artemy Kovalyov <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent afd1417 commit 9ec4483

File tree

1 file changed

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

1 file changed

+3
-1
lines changed

drivers/infiniband/hw/mlx5/mr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,8 +1375,10 @@ static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr)
13751375
if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
13761376
return 0;
13771377

1378-
umrwr.wr.send_flags = MLX5_IB_SEND_UMR_DISABLE_MR;
1378+
umrwr.wr.send_flags = MLX5_IB_SEND_UMR_DISABLE_MR |
1379+
MLX5_IB_SEND_UMR_UPDATE_PD_ACCESS;
13791380
umrwr.wr.opcode = MLX5_IB_WR_UMR;
1381+
umrwr.pd = dev->umrc.pd;
13801382
umrwr.mkey = mr->mmkey.key;
13811383
umrwr.ignore_free_state = 1;
13821384

0 commit comments

Comments
 (0)