Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1725523 > unrolled thread

[PATCH net] net: dsa: loop: Do not unregister invalid fixed PHY

Started byFlorian Fainelli <f.fainelli@gmail.com>
First post2017-09-02 18:00 +0200
Last post2017-09-04 05:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net] net: dsa: loop: Do not unregister invalid fixed PHY Florian Fainelli <f.fainelli@gmail.com> - 2017-09-02 18:00 +0200
    Re: [PATCH net] net: dsa: loop: Do not unregister invalid fixed PHY Andrew Lunn <andrew@lunn.ch> - 2017-09-02 18:20 +0200
    Re: [PATCH net] net: dsa: loop: Do not unregister invalid fixed PHY David Miller <davem@davemloft.net> - 2017-09-04 05:20 +0200

#1725523 — [PATCH net] net: dsa: loop: Do not unregister invalid fixed PHY

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2017-09-02 18:00 +0200
Subject[PATCH net] net: dsa: loop: Do not unregister invalid fixed PHY
Message-ID<uliZY-4Mu-15@gated-at.bofh.it>
During error injection it was possible to crash in dsa_loop_exit() because of
an attempt to unregister an invalid PHY. We actually want to the driver probing
in dsa_loop_init() even though fixed_phy_register() may return an error to
exercise how DSA deals with such cases, but we should not be crashing during
driver removal.

Fixes: 98cd1552ea27 ("net: dsa: Mock-up driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/dsa_loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
index fdd8f3872102..8150e3a3c8dd 100644
--- a/drivers/net/dsa/dsa_loop.c
+++ b/drivers/net/dsa/dsa_loop.c
@@ -390,7 +390,7 @@ static void __exit dsa_loop_exit(void)
 
 	mdio_driver_unregister(&dsa_loop_drv);
 	for (i = 0; i < NUM_FIXED_PHYS; i++)
-		if (phydevs[i])
+		if (!IS_ERR(phydevs[i]))
 			fixed_phy_unregister(phydevs[i]);
 }
 module_exit(dsa_loop_exit);
-- 
2.11.0

[toc] | [next] | [standalone]


#1725532

FromAndrew Lunn <andrew@lunn.ch>
Date2017-09-02 18:20 +0200
Message-ID<uljjk-5a4-5@gated-at.bofh.it>
In reply to#1725523
On Sat, Sep 02, 2017 at 08:56:45AM -0700, Florian Fainelli wrote:
> During error injection it was possible to crash in dsa_loop_exit() because of
> an attempt to unregister an invalid PHY. We actually want to the driver probing
> in dsa_loop_init() even though fixed_phy_register() may return an error to
> exercise how DSA deals with such cases, but we should not be crashing during
> driver removal.
> 
> Fixes: 98cd1552ea27 ("net: dsa: Mock-up driver")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

[toc] | [prev] | [next] | [standalone]


#1725820

FromDavid Miller <davem@davemloft.net>
Date2017-09-04 05:20 +0200
Message-ID<ulQ5A-9b-5@gated-at.bofh.it>
In reply to#1725523
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Sat,  2 Sep 2017 08:56:45 -0700

> During error injection it was possible to crash in dsa_loop_exit() because of
> an attempt to unregister an invalid PHY. We actually want to the driver probing
> in dsa_loop_init() even though fixed_phy_register() may return an error to
> exercise how DSA deals with such cases, but we should not be crashing during
> driver removal.
> 
> Fixes: 98cd1552ea27 ("net: dsa: Mock-up driver")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied and queued up for -stable, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web