]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: ethtool: optionally skip rtnl_lock in ethnl_act_module_fw_flash()
authorJakub Kicinski <kuba@kernel.org>
Fri, 5 Jun 2026 00:29:08 +0000 (17:29 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 9 Jun 2026 17:13:05 +0000 (10:13 -0700)
Module firmware flashing reads SFF-8024 identifier bytes via
.get_module_eeprom_by_page(). Other than that it modifies
a bit in the netdev->ethtool struct. Both should be ops-locked
at this point.

Reviewed-by: Eric Dumazet <edumazet@google.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260605002912.3456868-9-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/netdevice.h
net/ethtool/module.c

index 403b6d1c67f8f620898a91aa85821444b47573f3..9b876cd930d732f18680b28e2653341365824fc6 100644 (file)
@@ -2584,7 +2584,7 @@ struct net_device {
         *      @up, @moving_ns, @nd_net, @xdp_features
         *
         * Ops protects:
-        *      @cfg, @cfg_pending, @hwprov
+        *      @cfg, @cfg_pending, @ethtool, @hwprov
         *
         * Double ops protects:
         *      @real_num_rx_queues, @real_num_tx_queues
index c3388e6d7ec88b18b6a3d4004190a7aa97827fd8..9cf670e089f2be07640160e4f739ce7d5b43650a 100644 (file)
@@ -429,8 +429,7 @@ int ethnl_act_module_fw_flash(struct sk_buff *skb, struct genl_info *info)
                return ret;
        dev = req_info.dev;
 
-       rtnl_lock();
-       netdev_lock_ops(dev);
+       netdev_lock_ops_compat(dev);
        ret = ethnl_ops_begin(dev);
        if (ret < 0)
                goto out_unlock;
@@ -445,8 +444,7 @@ out_complete:
        ethnl_ops_complete(dev);
 
 out_unlock:
-       netdev_unlock_ops(dev);
-       rtnl_unlock();
+       netdev_unlock_ops_compat(dev);
        ethnl_parse_header_dev_put(&req_info);
        return ret;
 }