[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250718-phy_resume-v1-1-9c6b59580bee@gmail.com>
Date: Fri, 18 Jul 2025 15:42:22 +0000
From: Abid Ali <dev.nuvorolabs@...il.com>
To: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Abid Ali <dev.nuvorolabs@...il.com>
Subject: [PATCH] net: phy: Fix premature resume by a PHY driver
There are possibilities for phy_resume to be executed when the ethernet
interface is initially taken UP after bootup. This is harmless in most
cases, but the respective PHY driver`s resume callback cannot have any
logic that should only be executed if it was previously suspended.
In stmmac for instance, 2 entry points of phy_resume:
1. stmmac_open->phylink_of_phy_connect->phy_attach_direct->phy_resume
commit 1211ce530771 ("net: phy: resume/suspend PHYs on attach/detach")
This is not needed at the initial interface UP but required if the PHY
may suspend when the interface is taken DOWN.
2. stmmac_open->phylink_start->phy_start->__phy_resume
commit 9e573cfc35c6 ("net: phy: start interrupts in phy_start")
This patch does not introduce the __phy_resume in phy_start but removes
it from being conditional to PHY_HALTED. Now it fails to ensure if it
really needs to resume.
Prevent these duplicate access and provide logic exclusivity for resume
callback in a PHY driver.
Signed-off-by: Abid Ali <dev.nuvorolabs@...il.com>
---
drivers/net/phy/phy_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 73f9cb2e2844..68583bb74aec 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1846,7 +1846,7 @@ int __phy_resume(struct phy_device *phydev)
lockdep_assert_held(&phydev->lock);
- if (!phydrv || !phydrv->resume)
+ if (!phydrv || !phydrv->resume && phydev->suspended)
return 0;
ret = phydrv->resume(phydev);
---
base-commit: 347e9f5043c89695b01e66b3ed111755afcf1911
change-id: 20250718-phy_resume-cc86109396cc
Best regards,
--
Abid Ali <dev.nuvorolabs@...il.com>
Powered by blists - more mailing lists