* [PATCH] phylib: fix PAL state machine restart on resume
@ 2010-09-14 8:12 Simon Guinot
2010-09-14 21:31 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Simon Guinot @ 2010-09-14 8:12 UTC (permalink / raw)
To: netdev; +Cc: Simon Guinot
From: Simon Guinot <sguinot@lacie.com>
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>
---
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 6a6b819..6c58da2 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;
--
1.6.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] phylib: fix PAL state machine restart on resume
2010-09-14 8:12 [PATCH] phylib: fix PAL state machine restart on resume Simon Guinot
@ 2010-09-14 21:31 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-09-14 21:31 UTC (permalink / raw)
To: simon; +Cc: netdev, sguinot
From: Simon Guinot <simon@sequanux.org>
Date: Tue, 14 Sep 2010 10:12:01 +0200
> From: Simon Guinot <sguinot@lacie.com>
>
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-09-14 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-14 8:12 [PATCH] phylib: fix PAL state machine restart on resume Simon Guinot
2010-09-14 21:31 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.