Skip to content

Commit fddd910

Browse files
Simon Guinotdavem330
Simon Guinot
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ef885af commit fddd910

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/phy/mdio_bus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static int mdio_bus_suspend(struct device *dev)
308308
* may call phy routines that try to grab the same lock, and that may
309309
* lead to a deadlock.
310310
*/
311-
if (phydev->attached_dev)
311+
if (phydev->attached_dev && phydev->adjust_link)
312312
phy_stop_machine(phydev);
313313

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

333333
no_resume:
334-
if (phydev->attached_dev)
334+
if (phydev->attached_dev && phydev->adjust_link)
335335
phy_start_machine(phydev, NULL);
336336

337337
return 0;

0 commit comments

Comments
 (0)