net: axienet: fix teardown order of MDIO bus

Since the MDIO is is brought up before the netdev is registered, it
should be torn down after the netdev is removed. Otherwise, PHY accesses
can potentially access freed MDIO bus references and cause a crash.

Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Robert Hancock 2019-06-06 16:28:10 -06:00 committed by David S. Miller
parent 09a0354cad
commit e7a3d116fa

View File

@ -1651,8 +1651,8 @@ static int axienet_remove(struct platform_device *pdev)
struct net_device *ndev = platform_get_drvdata(pdev);
struct axienet_local *lp = netdev_priv(ndev);
axienet_mdio_teardown(lp);
unregister_netdev(ndev);
axienet_mdio_teardown(lp);
if (lp->clk)
clk_disable_unprepare(lp->clk);