Skip to content

ksettings_{get|set} lock fixes

Andrew Lunn netdev 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4phy: phy_ethtool_ksettings_get: Lock the phy for consistencydrivers/net/phy/phy.c+2 -00 replies
2/4phy: phy_ethtool_ksettings_set: Move after phy_start_anegdrivers/net/phy/phy.c+53 -530 replies
3/4phy: phy_start_aneg: Add an unlocked versiondrivers/net/phy/phy.c+24 -60 replies
4/4phy: phy_ethtool_ksettings_set: Lock the PHY while changing settingsdrivers/net/phy/phy.c+3 -10 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchWalter Stoll
1/4
2/4
3/4
4/4T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net 0/4] ksettings_{get|set} lock fixes

Walter Stoll <[email protected]> reported a race condition between "ethtool -s eth0 speed 100 duplex full autoneg off" and phylib reading the current status from the PHY. Both ksetting_get and ksetting_set fail the take the phydev mutex, and as a result, there is a small window of time where the phydev members are not self consistent.

Patch 1 fixes phy_ethtool_ksettings_get by adding the needed lock. Patches 2 and 3 move code around and perform to refactoring, to allow patch 4 to fix phy_ethtool_ksettings_set by added the lock.

Thanks go to Walter for the detailed origional report, suggested fix, and testing of the proposed patches.

Andrew Lunn (4):
phy: phy_ethtool_ksettings_get: Lock the phy for consistency
phy: phy_ethtool_ksettings_set: Move after phy_start_aneg
phy: phy_start_aneg: Add an unlocked version
phy: phy_ethtool_ksettings_set: Lock the PHY while changing settings

 drivers/net/phy/phy.c | 140 ++++++++++++++++++++++++------------------
 1 file changed, 81 insertions(+), 59 deletions(-)
Signature · 1 line
2.33.0