From e435d3180f7693edd20a1ef5389ce1a53a5c76de Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Tue, 3 Sep 2019 09:07:03 +0800 Subject: [PATCH] net: phy: force phy suspend when calling phy_stop mainline inclusion from mainline-v5.3 commit 95fb8bb3181bbe1ee87c95e91dff94f74f148c33 category: bugfix bugzilla: NA CVE: NA ------------------------------------------------- Some ethernet drivers may call phy_start() and phy_stop() from ndo_open() and ndo_close() respectively. When network cable is unconnected, and operate like below: step 1: ifconfig ethX up -> ndo_open -> phy_start ->start autoneg, and phy is no link. step 2: ifconfig ethX down -> ndo_close -> phy_stop -> just stop phy state machine. This patch forces phy suspend even phydev->link is off. Signed-off-by: Jian Shen Reviewed-by: Heiner Kallweit Signed-off-by: David S. Miller Reviewed-by: Yunsheng Lin Signed-off-by: Yang Yingliang --- drivers/net/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 1ee25877c4d1..5f931912519a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1060,8 +1060,8 @@ void phy_state_machine(struct work_struct *work) if (phydev->link) { phydev->link = 0; phy_link_down(phydev, true); - do_suspend = true; } + do_suspend = true; break; case PHY_RESUMING: if (AUTONEG_ENABLE == phydev->autoneg) { -- GitLab