]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: ethtool: add netif_get_link_ksettings() for correct ops-locked use
authorJakub Kicinski <kuba@kernel.org>
Wed, 3 Jun 2026 01:28:33 +0000 (18:28 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 4 Jun 2026 21:04:55 +0000 (14:04 -0700)
commitf32fe1d79a18592b96342a0016cd62cf9601a054
treef367fd4a7a3a5e78c5181eb318aac1f19414c23a
parentb8dfa196cb978815543a36bbdd077f4a161e160d
net: ethtool: add netif_get_link_ksettings() for correct ops-locked use

__ethtool_get_link_ksettings() is exported and called from sysfs
and many drivers. It invokes ethtool_ops->get_link_ksettings
so by our own docs it should be holding netdev lock for ops locked
devices. Looks like commit 2bcf4772e45a ("net: ethtool:
try to protect all callback with netdev instance lock")
missed adding the ops lock here.

There's a number of callers we need to fix up so let's add the
netif_get_link_ksettings() helper first, without any actual
locking changes (this commit is a nop).

Not treating this as a fix because I don't think any driver cares
at this point, but if we want to remove the rtnl_lock protection
this will become critical.

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20260603012840.2254293-5-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/ethtool.h
net/ethtool/ioctl.c
net/ethtool/linkinfo.c
net/ethtool/linkmodes.c