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: <20190121140055.GA7037@bogon.m.sigxcpu.org>
Date:   Mon, 21 Jan 2019 15:00:55 +0100
From:   Guido Günther <agx@...xcpu.org>
To:     Heiner Kallweit <hkallweit1@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: [PATCH] RFC: Revert "net: phy: check return code when requesting PHY
 driver module"

This unbreaks ethernet on e.g. the NXP imx8mq-evk using the fec driver.
Otherwise it fails like:

[    3.702671] device: '30be0000.ethernet-1': device_add
[    3.707783] PM: Adding info for No Bus:30be0000.ethernet-1
[    3.713329] libphy: fec_enet_mii_bus: probed
[    3.717815] mdio_bus 30be0000.ethernet-1:01: error -2 loading PHY driver module for ID 0x004dd074
[    3.726747] PM: Removing info for No Bus:30be0000.ethernet-1
[    3.732460] device: 'pps0': device_unregister
[    3.736911] PM: Removing info for No Bus:pps0
[    3.741317] device: 'ptp0': device_unregister
[    3.745761] PM: Removing info for No Bus:ptp0
[    3.750160] device: 'ptp0': device_create_release
[    3.755024] fec 30be0000.ethernet: Dropping the link to regulator.2
[    3.761359] fec: probe of 30be0000.ethernet failed with error -2

This reverts commit 13d0ab6750b20957ac1466da4e44dc0af746ff28.
---
On linux-next as somewhen starting at 2018-01-18 fec initialization
broke due to 13d0ab6750b20957ac1466da4e44dc0af746ff28. It welcome any
feedback how to fix this properly without eliminating the purpose of
the initial patch.

 drivers/net/phy/phy_device.c | 35 +++++------------------------------
 1 file changed, 5 insertions(+), 30 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index b61db0a5ba3a..636303e50173 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -558,31 +558,12 @@ static const struct device_type mdio_bus_phy_type = {
 	.pm = MDIO_BUS_PHY_PM_OPS,
 };
 
-static int phy_request_driver_module(struct phy_device *dev, int phy_id)
-{
-	int ret;
-
-	ret = request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
-			     MDIO_ID_ARGS(phy_id));
-	/* we only check for failures in executing the usermode binary,
-	 * not whether a PHY driver module exists for the PHY ID
-	 */
-	if (IS_ENABLED(CONFIG_MODULES) && ret < 0) {
-		phydev_err(dev, "error %d loading PHY driver module for ID 0x%08x\n",
-			   ret, phy_id);
-		return ret;
-	}
-
-	return 0;
-}
-
 struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 				     bool is_c45,
 				     struct phy_c45_device_ids *c45_ids)
 {
 	struct phy_device *dev;
 	struct mdio_device *mdiodev;
-	int ret = 0;
 
 	/* We allocate the device, and initialize the default values */
 	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
@@ -639,21 +620,15 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 			if (!(c45_ids->devices_in_package & (1 << i)))
 				continue;
 
-			ret = phy_request_driver_module(dev,
-						c45_ids->device_ids[i]);
-			if (ret)
-				break;
+			request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
+				       MDIO_ID_ARGS(c45_ids->device_ids[i]));
 		}
 	} else {
-		ret = phy_request_driver_module(dev, phy_id);
+		request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
+			       MDIO_ID_ARGS(phy_id));
 	}
 
-	if (!ret) {
-		device_initialize(&mdiodev->dev);
-	} else {
-		kfree(dev);
-		dev = ERR_PTR(ret);
-	}
+	device_initialize(&mdiodev->dev);
 
 	return dev;
 }
-- 
2.20.1

Powered by blists - more mailing lists