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-next>] [day] [month] [year] [list]
Message-ID: <42e0d1c5-fdd2-4347-874d-2dab736abbdc@gmail.com>
Date: Tue, 2 Jan 2024 16:54:51 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: Russell King <rmk+kernel@...linux.org.uk>, Andrew Lunn <andrew@...n.ch>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: [PATCH net-next] net: mdio_bus: make check in
 mdiobus_prevent_c45_scan more granular

Matching on OUI level is a quite big hammer. So let's make matching
more granular.

Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
---
 drivers/net/phy/mdio_bus.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 6cf73c156..fe4136649 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -621,19 +621,25 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus)
  */
 static bool mdiobus_prevent_c45_scan(struct mii_bus *bus)
 {
-	int i;
+	static const struct mdio_device_id id_list[] = {
+		{ MICREL_OUI << 10, GENMASK(31, 10) },
+	};
+	int i, j;
 
 	for (i = 0; i < PHY_MAX_ADDR; i++) {
 		struct phy_device *phydev;
-		u32 oui;
 
 		phydev = mdiobus_get_phy(bus, i);
 		if (!phydev)
 			continue;
-		oui = phydev->phy_id >> 10;
 
-		if (oui == MICREL_OUI)
-			return true;
+		for (j = 0; j < ARRAY_SIZE(id_list); j++) {
+			const struct mdio_device_id *id = id_list + j;
+
+			if (phy_id_compare(phydev->phy_id, id->phy_id,
+					   id->phy_id_mask))
+				return true;
+		}
 	}
 	return false;
 }
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ