From fa6114d4bde70152765ba1c35fed4fcd8481faf6 Mon Sep 17 00:00:00 2001 From: Nathan Sullivan Date: Fri, 7 Oct 2016 10:13:22 -0500 Subject: net: macb: NULL out phydev after removing mdio bus To ensure the dev->phydev pointer is not used after becoming invalid in mdiobus_unregister, set it to NULL. This happens when removing the macb driver without first taking its interface down, since unregister_netdev will end up calling macb_close. Signed-off-by: Xander Huff Signed-off-by: Nathan Sullivan Signed-off-by: Brad Mouring Reviewed-by: Moritz Fischer Acked-by: Nicolas Ferre Signed-off-by: David S. Miller --- drivers/net/ethernet/cadence/macb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/net/ethernet') diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 63144bb413d1..b32444a3ed79 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -3117,6 +3117,7 @@ static int macb_remove(struct platform_device *pdev) if (dev->phydev) phy_disconnect(dev->phydev); mdiobus_unregister(bp->mii_bus); + dev->phydev = NULL; mdiobus_free(bp->mii_bus); /* Shutdown the PHY if there is a GPIO reset */ -- cgit v1.2.3