Patch "net: fec: normalize return value of pm_runtime_get_sync() in MDIO write" has been added to the 4.2-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
net: fec: normalize return value of pm_runtime_get_sync() in MDIO write
to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
net-fec-normalize-return-value-of-pm_runtime_get_sync-in-mdio-write.patch
and it can be found in the queue-4.2 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Tue Nov 17 14:34:38 PST 2015
From: "Maciej S. Szmigiero" <[email protected]>
Date: Thu, 3 Sep 2015 21:38:30 +0200
Subject: net: fec: normalize return value of pm_runtime_get_sync() in MDIO write
From: "Maciej S. Szmigiero" <[email protected]>
[ Upstream commit 42ea4457aea7aaeddf0c0b06724f297608f5e9d2 ]
If fec MDIO write method succeeds its return value comes from call to pm_runtime_get_sync().
But pm_runtime_get_sync() can also return 1.
In case of Micrel KSZ9031 PHY this value will then
be returned along the call chain of phy_write() -> ksz9031_extended_write() -> ksz9031_center_flp_timing() -> ksz9031_config_init() -> phy_init_hw() -> phy_attach_direct() -> phy_connect_direct().
Then phy_connect() will cast it into a pointer using ERR_PTR(), which then fec_enet_mii_probe() will try to dereference resulting in an oops.
Fix it by normalizing return value of pm_runtime_get_sync() to be zero if positive in MDIO write method.
--- drivers/net/ethernet/freescale/fec_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_main.c +3 -1
@@ -1811,11 +1811,13 @@ static int fec_enet_mdio_write(struct mistruct fec_enet_private *fep = bus->priv;struct device *dev = &fep->pdev->dev;unsigned long time_left; -int ret =0 ; +int ret; ret =pm_runtime_get_sync (dev);if (ret <0 )return ret; +else + ret =0 ; fep->mii_timeout =0 ;reinit_completion (&fep->mdio_done);
Patches currently in stable-queue which might be from [email protected] are
queue-4.2/net-fec-normalize-return-value-of-pm_runtime_get_sync-in-mdio-write.patch