aboutsummaryrefslogtreecommitdiffstats
path: root/net/ethtool/module.c
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2025-03-05 16:37:28 +0000
committerJakub Kicinski <[email protected]>2025-03-06 20:59:44 +0000
commit2bcf4772e45adb00649a4e9cbff14b08a144f9e3 (patch)
tree3f9472a249e9d7ee3141be0bba0b8c53bf3a6b82 /net/ethtool/module.c
parentnet: hold netdev instance lock during ndo_bpf (diff)
downloadkernel-2bcf4772e45adb00649a4e9cbff14b08a144f9e3.tar.gz
kernel-2bcf4772e45adb00649a4e9cbff14b08a144f9e3.zip
net: ethtool: try to protect all callback with netdev instance lock
Protect all ethtool callbacks and PHY related state with the netdev instance lock, for drivers which want / need to have their ops instance-locked. Basically take the lock everywhere we take rtnl_lock. It was tempting to take the lock in ethnl_ops_begin(), but turns out we actually nest those calls (when generating notifications). Tested-by: Maxime Chevallier <[email protected]> Cc: Saeed Mahameed <[email protected]> Signed-off-by: Stanislav Fomichev <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/ethtool/module.c')
-rw-r--r--net/ethtool/module.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ethtool/module.c b/net/ethtool/module.c
index 6988e07bdcd6..d3d2e135e45e 100644
--- a/net/ethtool/module.c
+++ b/net/ethtool/module.c
@@ -419,19 +419,21 @@ int ethnl_act_module_fw_flash(struct sk_buff *skb, struct genl_info *info)
dev = req_info.dev;
rtnl_lock();
+ netdev_lock_ops(dev);
ret = ethnl_ops_begin(dev);
if (ret < 0)
- goto out_rtnl;
+ goto out_unlock;
ret = ethnl_module_fw_flash_validate(dev, info->extack);
if (ret < 0)
- goto out_rtnl;
+ goto out_unlock;
ret = module_flash_fw(dev, tb, skb, info);
ethnl_ops_complete(dev);
-out_rtnl:
+out_unlock:
+ netdev_unlock_ops(dev);
rtnl_unlock();
ethnl_parse_header_dev_put(&req_info);
return ret;