[PATCH 6/6] net: phy: Stop 'phy-state-machine' and 'phy_change' work on remove

From: Neil Armstrong
Date: Tue Oct 27 2015 - 10:49:35 EST


Avoids:
Unable to handle kernel NULL pointer dereference at virtual address 00000064
Workqueue: events_power_efficient phy_state_machine
PC is at phy_state_machine+0x28/0x480

Signed-off-by: Frode Isaksen <fisaksen@xxxxxxxxxxxx>
Signed-off-by: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
---
drivers/net/phy/phy_device.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 3833891..b5b6c1b 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1348,6 +1348,12 @@ static int phy_remove(struct device *dev)
phydev->state = PHY_DOWN;
mutex_unlock(&phydev->lock);

+ cancel_delayed_work_sync(&phydev->state_queue);
+ flush_delayed_work(&phydev->state_queue);
+
+ cancel_work_sync(&phydev->phy_queue);
+ flush_work(&phydev->phy_queue);
+
if (phydev->drv->remove)
phydev->drv->remove(phydev);
phydev->drv = NULL;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/