提交 5ae21950 编写于 作者: E Eric Dumazet 提交者: Jakub Kicinski

net: add net device refcount tracker to ethtool_phys_id()

This helper might hold a netdev reference for a long time,
lets add reference tracking.
Signed-off-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 0b688f24
...@@ -1989,6 +1989,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) ...@@ -1989,6 +1989,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr)
struct ethtool_value id; struct ethtool_value id;
static bool busy; static bool busy;
const struct ethtool_ops *ops = dev->ethtool_ops; const struct ethtool_ops *ops = dev->ethtool_ops;
netdevice_tracker dev_tracker;
int rc; int rc;
if (!ops->set_phys_id) if (!ops->set_phys_id)
...@@ -2008,7 +2009,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) ...@@ -2008,7 +2009,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr)
* removal of the device. * removal of the device.
*/ */
busy = true; busy = true;
dev_hold(dev); dev_hold_track(dev, &dev_tracker, GFP_KERNEL);
rtnl_unlock(); rtnl_unlock();
if (rc == 0) { if (rc == 0) {
...@@ -2032,7 +2033,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) ...@@ -2032,7 +2033,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr)
} }
rtnl_lock(); rtnl_lock();
dev_put(dev); dev_put_track(dev, &dev_tracker);
busy = false; busy = false;
(void) ops->set_phys_id(dev, ETHTOOL_ID_INACTIVE); (void) ops->set_phys_id(dev, ETHTOOL_ID_INACTIVE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册