* [PATCH net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
@ 2023-03-11 18:34 Heiner Kallweit
2023-03-13 13:36 ` Simon Horman
2023-03-15 7:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Heiner Kallweit @ 2023-03-11 18:34 UTC (permalink / raw)
To: Paolo Abeni, Eric Dumazet, Jakub Kicinski, David Miller,
Russell King - ARM Linux, Andrew Lunn
Cc: netdev@vger.kernel.org, Patrick Trantham
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.
Fixes: 4223dbffed9f ("net: phy: smsc: Re-enable EDPD mode for LAN87xx")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/smsc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index 9cfaccce1..721871184 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -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 */
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
2023-03-11 18:34 [PATCH net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails Heiner Kallweit
@ 2023-03-13 13:36 ` Simon Horman
2023-03-15 7:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-03-13 13:36 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Paolo Abeni, Eric Dumazet, Jakub Kicinski, David Miller,
Russell King - ARM Linux, Andrew Lunn, netdev@vger.kernel.org,
Patrick Trantham
On Sat, Mar 11, 2023 at 07:34:45PM +0100, Heiner Kallweit wrote:
> 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.
>
> Fixes: 4223dbffed9f ("net: phy: smsc: Re-enable EDPD mode for LAN87xx")
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
> ---
> drivers/net/phy/smsc.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
> index 9cfaccce1..721871184 100644
> --- a/drivers/net/phy/smsc.c
> +++ b/drivers/net/phy/smsc.c
> @@ -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 */
> --
> 2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
2023-03-11 18:34 [PATCH net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails Heiner Kallweit
2023-03-13 13:36 ` Simon Horman
@ 2023-03-15 7:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-15 7:20 UTC (permalink / raw)
To: Heiner Kallweit
Cc: pabeni, edumazet, kuba, davem, linux, andrew, netdev,
patrick.trantham
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sat, 11 Mar 2023 19:34:45 +0100 you wrote:
> 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.
>
> Fixes: 4223dbffed9f ("net: phy: smsc: Re-enable EDPD mode for LAN87xx")
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-15 7:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-11 18:34 [PATCH net] net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails Heiner Kallweit
2023-03-13 13:36 ` Simon Horman
2023-03-15 7:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).