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: <1437400094-11453-1-git-send-email-l.stach@pengutronix.de>
Date:	Mon, 20 Jul 2015 15:48:14 +0200
From:	Lucas Stach <l.stach@...gutronix.de>
To:	"David S. Miller" <davem@...emloft.net>
Cc:	Duan Andy <fugang.duan@...escale.com>,
	Frank Li <Frank.Li@...escale.com>,
	Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org,
	kernel@...gutronix.de, patchwork-lst@...gutronix.de
Subject: [PATCH] net: fec: fix runtime PM when probing MII bus

In the case where there is no "mdio" bus specified in the devicetree a plain
mdiobus_register() will be called, which tries to probe the connected PHY
by doing mdio_read() on the bus.
Since 6c3e921b18ed (net: fec: Ensure clocks are enabled while using mdio bus)
this needs runtime PM to be available, but as RPM is only later set up in the
FEC probe function those calls will fail, which in turn prevents the FEC
driver to be registered successfully.

Fix this by moving the RPM setup calls before the MII bus probing.

Also move autosuspend init calls before runtime_pm_enable() so that the RPM
callbacks aren't invoked several times during the probe function.

Signed-off-by: Lucas Stach <l.stach@...gutronix.de>
---
The offending commit got in with v4.2-rc3, so this should be applied as
a fix for 4.2.
---
 drivers/net/ethernet/freescale/fec_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 42e20e5385ac..349365d85b92 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3431,6 +3431,11 @@ fec_probe(struct platform_device *pdev)
 		fep->reg_phy = NULL;
 	}
 
+	pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT);
+	pm_runtime_use_autosuspend(&pdev->dev);
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
 	fec_reset_phy(pdev);
 
 	if (fep->bufdesc_ex)
@@ -3465,8 +3470,6 @@ fec_probe(struct platform_device *pdev)
 	netif_carrier_off(ndev);
 	fec_enet_clk_enable(ndev, false);
 	pinctrl_pm_select_sleep_state(&pdev->dev);
-	pm_runtime_set_active(&pdev->dev);
-	pm_runtime_enable(&pdev->dev);
 
 	ret = register_netdev(ndev);
 	if (ret)
@@ -3481,8 +3484,6 @@ fec_probe(struct platform_device *pdev)
 	fep->rx_copybreak = COPYBREAK_DEFAULT;
 	INIT_WORK(&fep->tx_timeout_work, fec_enet_timeout_work);
 
-	pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT);
-	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_runtime_mark_last_busy(&pdev->dev);
 	pm_runtime_put_autosuspend(&pdev->dev);
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ