Commit 324f2efc authored by Florian Fainelli's avatar Florian Fainelli Committed by Sasha Levin

net: phy: Fix PHY unbind crash

[ Upstream commit 7b9a88a3 ]

The PHY library does not deal very well with bind and unbind events. The first
thing we would see is that we were not properly canceling the PHY state machine
workqueue, so we would be crashing while dereferencing phydev->drv since there
is no driver attached anymore.
Suggested-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 128f29a4
...@@ -1281,6 +1281,8 @@ static int phy_remove(struct device *dev) ...@@ -1281,6 +1281,8 @@ static int phy_remove(struct device *dev)
{ {
struct phy_device *phydev = to_phy_device(dev); struct phy_device *phydev = to_phy_device(dev);
cancel_delayed_work_sync(&phydev->state_queue);
mutex_lock(&phydev->lock); mutex_lock(&phydev->lock);
phydev->state = PHY_DOWN; phydev->state = PHY_DOWN;
mutex_unlock(&phydev->lock); mutex_unlock(&phydev->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment