diff options
author | Eric Dumazet <edumazet@google.com> | 2021-12-04 20:22:00 -0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-12-06 16:05:10 -0800 |
commit | 5ae2195088d06adfd20eab98ecc9db80ef2eb6b2 (patch) | |
tree | 02b615cce4218b48b0f24715fc14dca66ebb34b2 /net/ethtool | |
parent | 0b688f24b7d611db3a02f3d4ab562d049c78a17d (diff) | |
download | linux-stable-5ae2195088d06adfd20eab98ecc9db80ef2eb6b2.tar.gz linux-stable-5ae2195088d06adfd20eab98ecc9db80ef2eb6b2.tar.bz2 linux-stable-5ae2195088d06adfd20eab98ecc9db80ef2eb6b2.zip |
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: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ethtool')
-rw-r--r-- | net/ethtool/ioctl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index fa8aa5ec19ba..9a113d893521 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -1989,6 +1989,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) struct ethtool_value id; static bool busy; const struct ethtool_ops *ops = dev->ethtool_ops; + netdevice_tracker dev_tracker; int rc; if (!ops->set_phys_id) @@ -2008,7 +2009,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) * removal of the device. */ busy = true; - dev_hold(dev); + dev_hold_track(dev, &dev_tracker, GFP_KERNEL); rtnl_unlock(); if (rc == 0) { @@ -2032,7 +2033,7 @@ static int ethtool_phys_id(struct net_device *dev, void __user *useraddr) } rtnl_lock(); - dev_put(dev); + dev_put_track(dev, &dev_tracker); busy = false; (void) ops->set_phys_id(dev, ETHTOOL_ID_INACTIVE); |