From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell King Subject: [PATCH 01/10] net: mvneta: ensure PM paths take the rtnl lock Date: Tue, 02 Jan 2018 17:24:34 +0000 Message-ID: References: <20180102172242.GE28752@n2100.armlinux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Cc: netdev@vger.kernel.org To: Andrew Lunn , Florian Fainelli , Thomas Petazzoni Return-path: Received: from pandora.armlinux.org.uk ([78.32.30.218]:57412 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbeABRYj (ORCPT ); Tue, 2 Jan 2018 12:24:39 -0500 In-Reply-To: <20180102172242.GE28752@n2100.armlinux.org.uk> Content-Disposition: inline Sender: netdev-owner@vger.kernel.org List-ID: The netdev core always ensures that the rtnl lock is held while calling the ndo_open() and ndo_stop() methods. However, the suspend/resume paths do not hold the rtnl lock. phylink will expect the rtnl lock to be held when the MAC driver calls it, so we end up with kernel warnings. Take the lock to ensure that these functions are called in a consistent manner. Signed-off-by: Russell King --- drivers/net/ethernet/marvell/mvneta.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index a539263cd79c..e08bd20352cb 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -4426,8 +4426,10 @@ static int mvneta_suspend(struct device *device) struct net_device *dev = dev_get_drvdata(device); struct mvneta_port *pp = netdev_priv(dev); + rtnl_lock(); if (netif_running(dev)) mvneta_stop(dev); + rtnl_unlock(); netif_device_detach(dev); clk_disable_unprepare(pp->clk_bus); clk_disable_unprepare(pp->clk); @@ -4464,10 +4466,12 @@ static int mvneta_resume(struct device *device) mvneta_fixed_link_update(pp, dev->phydev); netif_device_attach(dev); + rtnl_lock(); if (netif_running(dev)) { mvneta_open(dev); mvneta_set_rx_mode(dev); } + rtnl_unlock(); return 0; } -- 2.7.4