net: phy: avoid race when erroring stopping PHY
Status from this message: This series was applied to netdev/net-next.git (main)
Get series with b4
b4 am [email protected]Versions newest first
Changes from RFC from the cover letter
- Added Jijie Shao's tested-by
Patches in v1 Applied
None of the 7 patches the cover letter announces are in this archive.
Reviews trailers per patch
| Patch | Jijie Shao | Florian Fainelli | Marek Szyprowski |
|---|---|---|---|
| Series | T-b T-b T-b T-b T-b T-b T-b | R-b R-b R-b R-b R-b R-b R-b | T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH net-next 0/7] net: phy: avoid race when erroring stopping PHY
This series addresses a problem reported by Jijie Shao where the PHY state machine can race with phy_stop() leading to an incorrect state.
The issue centres around phy_state_machine() dropping the phydev->lock mutex briefly, which allows phy_stop() to get in half-way through the state machine, and when the state machine resumes, it overwrites phydev->state with a value incompatible with a stopped PHY. This causes a subsequent phy_start() to issue a warning.
We address this firstly by using versions of functions that do not take tne lock, moving them into the locked region. The only function that this can't be done with is phy_suspend() which needs to call into the driver without taking the lock.
For phy_suspend(), we split the state machine into two parts - the initial part which runs under the phydev->lock, and the second part which runs without the lock.
We finish off by using the split state machine in phy_stop() which removes another unnecessary unlock-lock sequence from phylib.
Changes from RFC:
- Added Jijie Shao's tested-by
drivers/net/phy/phy.c | 204 +++++++++++++++++++++++++++----------------------- 1 file changed, 110 insertions(+), 94 deletions(-)
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!