From patchwork Thu Jan 23 16:58:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kory Maincent X-Patchwork-Id: 13948468 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE58C3C463; Thu, 23 Jan 2025 17:00:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651612; cv=none; b=MwYW5zpB3ehjv9sgLuHHQaVEMZx1uNo+UUCcCo9dLlXQb+6z9yDETEMHdtKOaeIQMXoPufeJBpgv5yAwRwu25q5DzLGueJqzNCkvbe0ifXMnX81UpakSRIgiXeUtdFt99ntn5irt5ELBwVoqFsR6vqeSN76z7I7xyAh8UXdUZ0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651612; c=relaxed/simple; bh=a1xqH+ot/n+WwUJKmGMch9Gmph5UCrgJHrIJlfxGmgw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OgtxePObVBn4G4dkGO/Xak8Oem4YI142+ssOkgqfrINFnPLpONt5JW/fqnYhYnlrB5XXrRpcOHDUS5mt+iR83OjNc5kBIpiEmvvl+TnRQ29ae7qh2wjzyHI6mfA4xqf3VW8oXDLy5QQljkej08RoqnJb3jkjOC7dDFz5SxetuPI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=JQBcCEe+; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="JQBcCEe+" Received: by mail.gandi.net (Postfix) with ESMTPSA id 77C601BF207; Thu, 23 Jan 2025 17:00:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1737651608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=APFOFofNAriLkQoN+2DBivXiQlJ9mH2058hLi8ae2J4=; b=JQBcCEe+osfxTy7gxiIHiXIO7CrcCIBLWIozlv/uOiqgUyKwAKBxvAq5d+tGHgAmEfW+04 p3zhX0IPRzlJIctV5wcPyvFJvwLPMeUHV08/drWwcGDBgLMiXrQjPwqSJZ8S4A2HH+mzXv WpLFlOJZHUA/uW2HOs2iCd82tVQOlDkIgJaRqkKFRxFBSiFpDQ//wDdHlmNmr3fP0goqhv bbiu2p2p7lxHUUofZ4bKCQN1hDeaTFbs/GZvX5RJ2A0WbhQWPQ/Z5frf7SHL4n9FH9uBXO qWHENrCehHlCepDfLaZcJNSrxp4IFsQxNgXdgI4ZvDKSztQsokJvgobjwi9pcQ== From: Kory Maincent Date: Thu, 23 Jan 2025 17:58:01 +0100 Subject: [PATCH net v2 2/2] net: sh_eth: Fix missing rtnl lock in suspend path Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250123-fix_missing_rtnl_lock_phy_disconnect-v2-2-e6206f5508ba@bootlin.com> References: <20250123-fix_missing_rtnl_lock_phy_disconnect-v2-0-e6206f5508ba@bootlin.com> In-Reply-To: <20250123-fix_missing_rtnl_lock_phy_disconnect-v2-0-e6206f5508ba@bootlin.com> To: Paul Barker , =?utf-8?q?Niklas_S=C3=B6der?= =?utf-8?q?lund?= , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Mikhail Ulyanov , Sergei Shtylyov Cc: Thomas Petazzoni , =?utf-8?q?Niklas_S?= =?utf-8?q?=C3=B6derlund?= , Claudiu Beznea , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Kory Maincent , Sergey Shtylyov X-Mailer: b4 0.14.1 X-GND-Sasl: kory.maincent@bootlin.com Fix the suspend path by ensuring the rtnl lock is held where required. Calls to sh_eth_close, sh_eth_open and wol operations must be performed under the rtnl lock to prevent conflicts with ongoing ndo operations. Fixes: b71af04676e9 ("sh_eth: add more PM methods") Tested-by: Niklas Söderlund Reviewed-by: Sergey Shtylyov Signed-off-by: Kory Maincent --- drivers/net/ethernet/renesas/sh_eth.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 8887b8921009..5fc8027c92c7 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -3494,10 +3494,12 @@ static int sh_eth_suspend(struct device *dev) netif_device_detach(ndev); + rtnl_lock(); if (mdp->wol_enabled) ret = sh_eth_wol_setup(ndev); else ret = sh_eth_close(ndev); + rtnl_unlock(); return ret; } @@ -3511,10 +3513,12 @@ static int sh_eth_resume(struct device *dev) if (!netif_running(ndev)) return 0; + rtnl_lock(); if (mdp->wol_enabled) ret = sh_eth_wol_restore(ndev); else ret = sh_eth_open(ndev); + rtnl_unlock(); if (ret < 0) return ret;