Skip to content

Commit

Permalink
net: axienet: fix teardown order of MDIO bus
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robert Hancock authored and David S. Miller committed Jun 6, 2019
1 parent 09a0354 commit e7a3d11
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/xilinx/xilinx_axienet_main.c
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit e7a3d11

Please sign in to comment.