FAILED: patch "[PATCH] IB/mlx5: Move MRs to a kernel PD when freeing them to the MR" failed to apply to 4.9-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 9ec4483a3f0f71a228a5933bc040441322bfb090 Mon Sep 17 00:00:00 2001
From: Yishai Hadas <[email protected]>
Date: Tue, 23 Jul 2019 09:57:27 +0300
Subject: [PATCH] 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.
drivers/infiniband/hw/mlx5/mr.c +3 -1
@@ -1375,8 +1375,10 @@ static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr)if (mdev->state ==MLX5_DEVICE_STATE_INTERNAL_ERROR )return 0 ; - umrwr.wr.send_flags =MLX5_IB_SEND_UMR_DISABLE_MR ; + umrwr.wr.send_flags =MLX5_IB_SEND_UMR_DISABLE_MR | +MLX5_IB_SEND_UMR_UPDATE_PD_ACCESS ; umrwr.wr.opcode =MLX5_IB_WR_UMR ; + umrwr.pd = dev->umrc.pd; umrwr.mkey = mr->mmkey.key; umrwr.ignore_free_state =1 ;