Skip to content

Commit

Permalink
phylib: fix PAL state machine restart on resume
Browse files Browse the repository at this point in the history
On resume, before starting the PAL state machine, check if the
adjust_link() method is well supplied. If not, this would lead to a
NULL pointer dereference in the phy_state_machine() function.

This scenario can happen if the Ethernet driver call manually the PHY
functions instead of using the PAL state machine. The mv643xx_eth driver
is a such example.

Signed-off-by: Simon Guinot <sguinot@lacie.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Simon Guinot authored and David S. Miller committed Sep 14, 2010
1 parent ef885af commit fddd910
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/phy/mdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ static int mdio_bus_suspend(struct device *dev)
* may call phy routines that try to grab the same lock, and that may
* lead to a deadlock.
*/
if (phydev->attached_dev)
if (phydev->attached_dev && phydev->adjust_link)
phy_stop_machine(phydev);

if (!mdio_bus_phy_may_suspend(phydev))
Expand All @@ -331,7 +331,7 @@ static int mdio_bus_resume(struct device *dev)
return ret;

no_resume:
if (phydev->attached_dev)
if (phydev->attached_dev && phydev->adjust_link)
phy_start_machine(phydev, NULL);

return 0;
Expand Down

0 comments on commit fddd910

Please sign in to comment.