From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:46976 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755017AbbKQWlN (ORCPT ); Tue, 17 Nov 2015 17:41:13 -0500 Subject: Patch "net: fec: normalize return value of pm_runtime_get_sync() in MDIO write" has been added to the 4.2-stable tree To: mail@maciej.szmigiero.name, andrew@lunn.ch, davem@davemloft.net, gregkh@linuxfoundation.org Cc: , From: Date: Tue, 17 Nov 2015 14:41:12 -0800 Message-ID: <144780007235171@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: 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 know about it. >>From foo@baz Tue Nov 17 14:34:38 PST 2015 From: "Maciej S. Szmigiero" 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" [ 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 Acked-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- 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