From: Li RongQing <lirongqing@baidu.com>
mlx5_data_direct_ib_unreg() removes and frees the registration entry
but, unlike mlx5_data_direct_dev_unreg(), does not call
mlx5_ib_data_direct_unbind().
As a result, when an IB device is unregistered while its affiliated
data-direct device is still registered, its data_direct_dev pointer
is left set and its data-direct MRs are not revoked.
Call mlx5_ib_data_direct_unbind() before removing the registration so
that the data-direct MRs are revoked and data_direct_dev is cleared
during IB device teardown as well.
Fixes: 6910e3660d86 ("RDMA/mlx5: Introduce the 'data direct' driver")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
drivers/infiniband/hw/mlx5/data_direct.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/infiniband/hw/mlx5/data_direct.c b/drivers/infiniband/hw/mlx5/data_direct.c
index d574842..54c07ac 100644
--- a/drivers/infiniband/hw/mlx5/data_direct.c
+++ b/drivers/infiniband/hw/mlx5/data_direct.c
@@ -113,6 +113,7 @@ void mlx5_data_direct_ib_unreg(struct mlx5_ib_dev *ibdev)
mutex_lock(&mlx5_data_direct_mutex);
list_for_each_entry(reg, &mlx5_data_direct_reg_list, list) {
if (reg->ibdev == ibdev) {
+ mlx5_ib_data_direct_unbind(reg->ibdev);
list_del(®->list);
kfree(reg);
goto end;
--
2.9.4