diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2026-06-02 18:28:40 -0700 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-06-04 14:04:56 -0700 |
| commit | 9f275c2e9020a68b71a3c3bbe5d96e7c3546eee1 (patch) | |
| tree | a87d63af73652ca5c93540a5fc051aba1db7b2a8 /net | |
| parent | af1737dab07c861c3de4576f19dcfbd8f2329eb8 (diff) | |
| download | linux-next-9f275c2e9020a68b71a3c3bbe5d96e7c3546eee1.tar.gz linux-next-9f275c2e9020a68b71a3c3bbe5d96e7c3546eee1.zip | |
net: ethtool: make sure __ethtool_get_link_ksettings() is ops-locked
All drivers which may call *_get_link_ksettings() on ops-locked
devices from paths already holding the ops lock are ready now.
Make __ethtool_get_link_ksettings() take the ops lock, and assert
that it's held in netif_get_link_ksettings().
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20260603012840.2254293-12-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/ethtool/ioctl.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 49da873b673d..a4b0cbae4063 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -439,7 +439,7 @@ struct ethtool_link_usettings { int netif_get_link_ksettings(struct net_device *dev, struct ethtool_link_ksettings *link_ksettings) { - /* once callers fixed - assert ops locked */ + netdev_assert_locked_ops_compat(dev); if (!dev->ethtool_ops->get_link_ksettings) return -EOPNOTSUPP; @@ -456,10 +456,14 @@ EXPORT_SYMBOL(netif_get_link_ksettings); int __ethtool_get_link_ksettings(struct net_device *dev, struct ethtool_link_ksettings *link_ksettings) { + int ret; + ASSERT_RTNL(); - /* once callers fixed - take the ops lock around this call */ - return netif_get_link_ksettings(dev, link_ksettings); + netdev_lock_ops(dev); + ret = netif_get_link_ksettings(dev, link_ksettings); + netdev_unlock_ops(dev); + return ret; } EXPORT_SYMBOL(__ethtool_get_link_ksettings); |
