[PATCH net-next] phylink: avoid attaching more than one PHY

Subsystems: ethernet phy library, networking drivers, sff/sfp/sfp+ module support, the rest

STALE3226d

3 messages, 3 authors, 2017-12-21 · open the first message on its own page

[PATCH net-next] phylink: avoid attaching more than one PHY

From: Russell King <hidden>
Date: 2017-12-20 23:23:36

Attaching more than one PHY to phylink is bad news, as we store a
pointer to the PHY in a single location. Error out if more than one
PHY is attempted to be attached.

Signed-off-by: Russell King <redacted>
---
 drivers/net/phy/phylink.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index db5d5726ced9..82166a26f5c6 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -726,6 +726,9 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
 		     phy_interface_mode_is_8023z(pl->link_interface))))
 		return -EINVAL;
 
+	if (pl->phydev)
+		return -EBUSY;
+
 	/* Use PHY device/driver interface */
 	if (pl->link_interface == PHY_INTERFACE_MODE_NA) {
 		pl->link_interface = phy->interface;
-- 
2.7.4

Re: [PATCH net-next] phylink: avoid attaching more than one PHY

From: Andrew Lunn <andrew@lunn.ch>
Date: 2017-12-21 11:41:11

On Wed, Dec 20, 2017 at 11:23:33PM +0000, Russell King wrote:
Attaching more than one PHY to phylink is bad news, as we store a
pointer to the PHY in a single location. Error out if more than one
PHY is attempted to be attached.

Signed-off-by: Russell King <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

Re: [PATCH net-next] phylink: avoid attaching more than one PHY

From: David Miller <davem@davemloft.net>
Date: 2017-12-21 20:03:37

From: Russell King <redacted>
Date: Wed, 20 Dec 2017 23:23:33 +0000
Attaching more than one PHY to phylink is bad news, as we store a
pointer to the PHY in a single location. Error out if more than one
PHY is attempted to be attached.

Signed-off-by: Russell King <redacted>
Applied, thank you.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help