summaryrefslogtreecommitdiff
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2023-09-14 18:35:31 +0300
committerDavid S. Miller <davem@davemloft.net>2023-09-17 16:31:23 +0300
commit8da77df649c43d9cec70d683ee317ba5d49d09b7 (patch)
tree482523f3da161f261a0bb252553d78a2e851ac41 /drivers/net/phy
parent002841be134e60994a34b510eebf5f091d0cd6c6 (diff)
downloadlinux-8da77df649c43d9cec70d683ee317ba5d49d09b7.tar.xz
net: phy: always call phy_process_state_change() under lock
phy_stop() calls phy_process_state_change() while holding the phydev lock, so also arrange for phy_state_machine() to do the same, so that this function is called with consistent locking. Tested-by: Jijie Shao <shaojijie@huawei.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/phy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index df54c137c5f5..1e5218935eb3 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1506,6 +1506,7 @@ void phy_state_machine(struct work_struct *work)
if (err < 0)
phy_error_precise(phydev, func, err);
+ mutex_lock(&phydev->lock);
phy_process_state_change(phydev, old_state);
/* Only re-schedule a PHY state machine change if we are polling the
@@ -1516,7 +1517,6 @@ void phy_state_machine(struct work_struct *work)
* state machine would be pointless and possibly error prone when
* called from phy_disconnect() synchronously.
*/
- mutex_lock(&phydev->lock);
if (phy_polling_mode(phydev) && phy_is_started(phydev))
phy_queue_state_machine(phydev, PHY_STATE_TIME);
mutex_unlock(&phydev->lock);