diff options
author | Simon Guinot <sguinot@lacie.com> | 2010-09-13 22:12:01 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-14 14:31:03 -0700 |
commit | fddd91016d16277a32727ad272cf2edd3d309c90 (patch) | |
tree | de26d726a987469aabe804d4b32733c559b9291c /drivers/net/phy | |
parent | ef885afbf8a37689afc1d9d545e2f3e7a8276c17 (diff) | |
download | linux-stable-fddd91016d16277a32727ad272cf2edd3d309c90.tar.gz linux-stable-fddd91016d16277a32727ad272cf2edd3d309c90.tar.bz2 linux-stable-fddd91016d16277a32727ad272cf2edd3d309c90.zip |
phylib: fix PAL state machine restart on resume
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>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 6a6b8199a0d6..6c58da2b882c 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -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)) @@ -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; |