net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
Subsystems (3)
Heiner Kallweit
maintainerPATCH 1/1 net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
If genphy_read_status fails then further access to the PHY may result in unpredictable behavior. To prevent this bail out immediately if genphy_read_status fails.
--- drivers/net/phy/smsc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/phy/smsc.c +4 -1
@@ -189,8 +189,11 @@ static int lan95xx_config_aneg_ext(struct phy_device *phydev)static int lan87xx_read_status (struct phy_device *phydev) {struct smsc_phy_priv *priv = phydev->priv; +int err; -int err =genphy_read_status (phydev); + err =genphy_read_status (phydev); +if (err) +return err;if (!phydev->link && priv->energy_enable && phydev->irq ==PHY_POLL ) {/* Disable EDPD to wake up PHY */
Signature · 1 line
2.39.2
Quoted 6 lines · Heiner Kallweit
If
genphy_read_statusfails then further access to the PHY may result in unpredictable behavior. To prevent this bail out immediately ifgenphy_read_statusfails.Fixes 4223dbffed9f ("net: phy: smsc: Re-enable EDPD mode for LAN87xx")Signed-off-by Heiner Kallweit <[email protected]>
Quoted 23 lines
--- drivers/net/phy/smsc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/phy/smsc.c +4
-1@@ -189,8 +189,11 @@ static int lan95xx_config_aneg_ext(struct phy_device *phydev)static int lan87xx_read_status (struct phy_device *phydev) {struct smsc_phy_priv *priv = phydev->priv; +int err; -int err =genphy_read_status (phydev); + err =genphy_read_status (phydev); +if (err) +return err;if (!phydev->link && priv->energy_enable && phydev->irq ==PHY_POLL ) {/* Disable EDPD to wake up PHY */ Signature · 1 line
2.39.2
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Sat, 11 Mar 2023 19:34:45 +0100 you wrote:
If
genphy_read_statusfails then further access to the PHY may result in unpredictable behavior. To prevent this bail out immediately ifgenphy_read_statusfails.Fixes 4223dbffed9f ("net: phy: smsc: Re-enable EDPD mode for LAN87xx")Signed-off-by Heiner Kallweit <[email protected]>[...]
Here is the summary with links:
- [net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
https://git.kernel.org/netdev/net/c/c22c3bbf351e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html