* Patch "net: fec: normalize return value of pm_runtime_get_sync() in MDIO write" has been added to the 4.2-stable tree
@ 2015-11-17 22:41 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-11-17 22:41 UTC (permalink / raw)
To: mail, andrew, davem, gregkh; +Cc: stable, stable-commits
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 <stable@vger.kernel.org> know about it.
>From foo@baz Tue Nov 17 14:34:38 PST 2015
From: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
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" <mail@maciej.szmigiero.name>
[ 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.
Fixes: 8fff755e9f8d ("net: fec: Ensure clocks are enabled while using mdio bus")
Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/ethernet/freescale/fec_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1811,11 +1811,13 @@ static int fec_enet_mdio_write(struct mi
struct 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 mail@maciej.szmigiero.name are
queue-4.2/net-fec-normalize-return-value-of-pm_runtime_get_sync-in-mdio-write.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-11-17 22:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17 22:41 Patch "net: fec: normalize return value of pm_runtime_get_sync() in MDIO write" has been added to the 4.2-stable tree gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).