Please ignore the previous email. I overlooked some logic. Sorry for the
disturbance.
在 2025/3/14 16:54, luoxuanqiang 写道:
From: luoxuanqiang <luoxuanqiang@xxxxxxxxxx>
When adding the "netdevice ref tracker" mechanism to ib_port_data, the
dev_hold() in ib_device_get_netdev() was missed, which may cause false
alarms of ref leak. Replace dev_hold() with netdev_hold() to fix it.
Fixes: 09f530f0c6d6 ("RDMA: Add netdevice_tracker to ib_device_set_netdev()")
Signed-off-by: luoxuanqiang <luoxuanqiang@xxxxxxxxxx>
---
drivers/infiniband/core/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 0ded91f056f3..f65a7e2b4f2b 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2270,7 +2270,7 @@ struct net_device *ib_device_get_netdev(struct ib_device *ib_dev,
spin_lock(&pdata->netdev_lock);
res = rcu_dereference_protected(
pdata->netdev, lockdep_is_held(&pdata->netdev_lock));
- dev_hold(res);
+ netdev_hold(res, &pdata->netdev_tracker, GFP_ATOMIC);
spin_unlock(&pdata->netdev_lock);
}