Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] RDMA/mlx5: Unbind data direct device on IB device unregister
@ 2026-09-23  8:14 lirongqing
  2026-09-23  8:31 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: lirongqing @ 2026-09-23  8:14 UTC (permalink / raw)
  To: Leon Romanovsky, Jason Gunthorpe, Yishai Hadas, linux-rdma,
	linux-kernel
  Cc: Li RongQing

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(&reg->list);
 			kfree(reg);
 			goto end;
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-23  8:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-23  8:14 [PATCH] RDMA/mlx5: Unbind data direct device on IB device unregister lirongqing
2026-09-23  8:31 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox