RDMA/device: Change dev_hold() to netdev_hold() in ib_device_get_netdev()
PATCH 1/1 RDMA/device: Change dev_hold() to netdev_hold() in ib_device_get_netdev()
From: luoxuanqiang <[email protected]>
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 <[email protected]>
--- drivers/infiniband/core/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/device.c +1 -1
@@ -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); }
Signature · 1 line
2.27.0
Please ignore the previous email. I overlooked some logic. Sorry for the disturbance.
Quoted 25 lines · luoxuanqiang
From: luoxuanqiang <[email protected]>
When adding the "netdevice ref tracker" mechanism to
ib_port_data, thedev_hold()inib_device_get_netdev()was missed, which may cause false alarms of ref leak. Replacedev_hold()withnetdev_hold()to fix it.Fixes 09f530f0c6d6 ("RDMA: Add netdevice_tracker to ib_device_set_netdev()")Signed-off-by luoxuanqiang <[email protected]>--- drivers/infiniband/core/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/core/device.c +1
-1@@ -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); }