lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: 
 <174354300640.26800.16674542763242575337.stgit@ahduyck-xeon-server.home.arpa>
Date: Tue, 01 Apr 2025 14:30:06 -0700
From: Alexander Duyck <alexander.duyck@...il.com>
To: netdev@...r.kernel.org
Cc: linux@...linux.org.uk, andrew@...n.ch, hkallweit1@...il.com,
 davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
 maxime.chevallier@...tlin.com
Subject: [net PATCH 1/2] net: phy: Cleanup handling of recent changes to
 phy_lookup_setting

From: Alexander Duyck <alexanderduyck@...com>

The blamed commit introduced an issue where it was limiting the link
configuration so that we couldn't use fixed-link mode for any settings
other than twisted pair modes 10G or less. As a result this was causing the
driver to lose any advertised/lp_advertised/supported modes when setup as a
fixed link.

To correct this we can add a check to identify if the user is in fact
enabling a TP mode and then apply the mask to select only 1 of each speed
for twisted pair instead of applying this before we know the number of bits
set.

Fixes: de7d3f87be3c ("net: phylink: Use phy_caps_lookup for fixed-link configuration")
Signed-off-by: Alexander Duyck <alexanderduyck@...com>
---
 drivers/net/phy/phylink.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 16a1f31f0091..380e51c5bdaa 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -713,17 +713,24 @@ static int phylink_parse_fixedlink(struct phylink *pl,
 		phylink_warn(pl, "fixed link specifies half duplex for %dMbps link?\n",
 			     pl->link_config.speed);
 
-	linkmode_zero(pl->supported);
-	phylink_fill_fixedlink_supported(pl->supported);
-
+	linkmode_fill(pl->supported);
 	linkmode_copy(pl->link_config.advertising, pl->supported);
 	phylink_validate(pl, pl->supported, &pl->link_config);
 
 	c = phy_caps_lookup(pl->link_config.speed, pl->link_config.duplex,
 			    pl->supported, true);
-	if (c)
+	if (c) {
 		linkmode_and(match, pl->supported, c->linkmodes);
 
+		/* Compatbility with the legacy behaviour:
+		 * Report one single BaseT mode.
+		 */
+		phylink_fill_fixedlink_supported(mask);
+		if (linkmode_intersects(match, mask))
+			linkmode_and(match, match, mask);
+		linkmode_zero(mask);
+	}
+
 	linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, mask);
 	linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, mask);
 	linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, mask);



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ