| Message ID | 20261112-sun8i-emac-mux-uaf-v1-1-308ae7e6fcf2@gmail.com (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-27539-sunxi=pue.re@lists.linux.dev> X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mxe881.netcup.net (Postfix) with ESMTPS id C6ACA1C7640 for <noreply@patchwork.local>; Thu, 12 Nov 2026 06:41:49 +0100 (CET) Authentication-Results: mxe881; dkim=pass header.d=kernel.org; spf=pass (sender IP is 104.64.211.4) smtp.mailfrom=linux-sunxi+bounces-27539-noreply=patchwork.local@lists.linux.dev smtp.helo=sin.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 104.64.211.4 as permitted sender) client-ip=104.64.211.4; envelope-from=linux-sunxi+bounces-27539-noreply=patchwork.local@lists.linux.dev; helo=sin.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id A8144C3C12 for <noreply@patchwork.local>; Thu, 12 Nov 2026 05:28:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794461287; b=lONMh5SkI72+L/BckS7zsl1aUXGiM2ozRttnlvIlMACAZAKv0WIan9mt8ZOyZFa2YCrN FI6skvRLAqiTsNlGl8C0cuI7pRqysc1bkNe7oy3QKfZpKMgqiFpEAoWWO8O5aNiTcchia EpOeIhB3eSrhfFp8cKFwY1X+ksaSWrv4vuuiVbMDE1EXZ4fp4nuL5eGGP9bDp4XzvCd3d L8X7NtDHkAq+1aAVzrGrpyG+TKkXqyN6tefQYcT1xVhUgwUYB8xVdliAkBwTPn6LvaMIV sBOZuyaW+Wjkcg/ZgcGiUaqrbCDxD5uMe95bcfcZUiNzPoGe5FjR00etsL1QEphP+CQ== ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794461287; h=X-Original-To:Received:Received:DKIM-Signature:Received:From:Date: Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Message-Id:X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=W6mZOJg0qLo6Oh/FE3CEb1vYHcaROZa/HUARz/kORXE=; b=DrXlEXiuDHS7sxfyFwPLDeritGXlrmBU+SQyRrRvNuPgmOa6UyLOlMTA+Zt9wUKmmsv0 mQFTULH3uQTguS+qRG14r2Q5k8fif+P7WVhgbg5iOaN22U+qHi9fwqTD4zTU9bwbVDT3y vXJc19NGbIx7Fa/8JzkbXTFJJUmsxvtdQzwENN0Yp9dgSQwmS6dx2fLYFZ4kM+X5UKKRS ikpQb5WhslPx5CsSjpMrETJSPQLhm3c3h1HyMuO1khGnSFG7OxKePMwcyVj0IMViGP4fE QDIq0eBimhZpKsqP22KZI174MzmcESfq1533YRTT7HAe4oObl4lWTFyQZ3fFDJx7KJw== ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oZiRt3k+; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80C3B606A331; Thu, 12 Nov 2026 05:28:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oZiRt3k+ X-Original-To: linux-sunxi@lists.linux.dev Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794461287; b=BjRZRYOBrFH/uY1eriU1p6jcN2Kf93NeLSax5kXALgpm5Dvy+2X5ZsD2hONzkpaTVCqw MNeV9nsMbQztae2w+++7zA1zU2S6YUnSHr39+7PnRbI8h+2jnA5KWDqeIA5m3Xb6xZgcr mXsw8yjjIXluISpg9mirTVu0j8hwt1iS9jolv82yFNdE1H0DKOhBUEa6nyMNeWqA1nUXv lnqzl60pXtfAcCklMb/F5bgkZWobFUtqzMsXSaYVzwNkjyfRZGDJVHYDAOslKHXTWVOdY x3SLhU42qYrEjz/5hCyJwoHG/OvQ1LTngHzWpzzPn1uR5hjUFZgCMTeSRpEcVzKc3IA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794461287; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=W6mZOJg0qLo6Oh/FE3CEb1vYHcaROZa/HUARz/kORXE=; b=GiA3p2vSPgvLXYkyykb+/Hjg52Olfni68H0Rb0UpuXw3UWTJlEfnb0eaz5kgG0IqFHxf Byivht8jWedQUC48K+QVKq4AZb+7adkKukrirvY2ASlWr687FTuU4lxvX3/p/Hz1G5wUk JOPZGfgbGTAnzZGaB5osEnmpUMfAG4lGP81JHjm47w4BYYC4eoDRf8vVVzwH76qQ2td21 ycV3WxqeH/VJL74LIJ+DDaduEoOgo2VrsQZ79qxsVZqfu+KSHMFtQihGNrTQHIktWXreU L7HFhs3pXNCPwW1ispN8u/EP0Fwap3DU6iXWpFHq2UTgq8xRHf+/3yekwMvMtNFPvdQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oZiRt3k+; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EAD2606A324; Thu, 12 Nov 2026 05:28:07 +0000 (UTC) Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1794461286; b=H9vUwjI/2pkawjH/yZx1jvNuHTPxjiRtRdl7q3GBJiAW+cGTyKvzraBxdjf3ac8KUJlS BhSHLgKygYT2buK7BE/zxMQTr8yah58ekCGWBlac0UiqDtWS1sR6lIXXRzYyFEGCLbtnC jdR71tL69Rv4BPzsdR1kP0Xl/EoD6ZjUvxdCqRK1R79Mx430WOtx+sC65Jwi31/tHMHrn S0JmzKtxhLkSFtmrvwxFmecaSBc0OQ+NqJJlU5j7qLrmTXqdfVZdrDPQIVDv+5Lt8MmzA m+Sxzm3WNYhaDPsUW31rve1VL5++iatVtfGhp554KL2KjPB/UyETXwyVy2ciT0TyiQg== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1794461286; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=W6mZOJg0qLo6Oh/FE3CEb1vYHcaROZa/HUARz/kORXE=; b=0hMwJi/5kZc60K2cThvoO09Io1eeh0RrhWnGdZXC3eFF0SjfZj5LZvtO0AcaKqHIbffy qiSD7LzvrjXJtS5/3MKy+LUm9ZnKAL8Btlnp/Si/XVaOOVdGY1vhQ1x+SOLR30dqoSVHC pNI7ADcZ4TxbTZSnGVImx3Jigl9WYpkIAZDtENfBo49eq4ZE5/Rq1oVc9XGjhKX0delAM /8TIle5esV+XRKMwOW8BlSt8qJJyWazvS4Kf4UTTLd7M3/lRs+v++8WE8rUQhhe7jYCpi uM/+kM5o/0YGgjbQSI/y3x/dHXdhfTz5Okhr7PUl9cDdVCA0MT4KRgm9aCX2kGabTQw== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id BE6021F00A09; Thu, 12 Nov 2026 05:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794461286; bh=W6mZOJg0qLo6Oh/FE3CEb1vYHcaROZa/HUARz/kORXE=; h=From:Date:Subject:To:Cc:Reply-To; b=oZiRt3k+5VLSUnqmGNXWTTO6XAnuzwR740thG6dGPVl3CLpu1FDFmdE11owrSmqHq BPFDoflNNhsytwPaBdJ8JhyV754h7lCpwdE/FDqYxIu2aRBrwKBGgstP8qCG3tzZnz E3LBdofMaNeN4NUv42K00Hcr6EgBj5Puv6/2mIH1CrXXq9A7+t0LbG3IuhNEPt3DCo ZzplRRTlAQtRWpu0Pqn0zelwNIYYb3W3Mgm7T1PuSHTfpZE2WeiRFX9DEdMVAeQ1oO vMXvekvdKbmqQM/lPOjKY8cMYI+n8KFblDFKuxL0R+R7EEao16nZI/CADHTZOpXNAV uVHkLkvs3KyTA== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 3815549191; Thu, 12 Nov 2026 05:28:05 +0000 (UTC) From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org> Date: Thu, 12 Nov 2026 05:28:05 +0000 Subject: [PATCH net] net: stmmac: dwmac-sun8i: Fix use-after-free in the MDIO mux error path X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: <linux-sunxi.lists.linux.dev> List-Post: <mailto:linux-sunxi@lists.linux.dev> List-Help: <mailto:linux-sunxi+help@lists.linux.dev> List-Subscribe: <mailto:linux-sunxi+subscribe@lists.linux.dev> List-Unsubscribe: <mailto:linux-sunxi+unsubscribe@lists.linux.dev> List-Owner: <mailto:linux-sunxi+owner@lists.linux.dev> Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261112-sun8i-emac-mux-uaf-v1-1-308ae7e6fcf2@gmail.com> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/yWMwQrCMBAFf6Xs2QU3YIn+inhI44uu0CjZphRK/ 91UjzMws5KhKIwu3UoFs5q+cwM5dBSfIT/Aem9M7uh6EXFsNXtljCHyWBeuIbEMwfuTk3MCqIW fgqTLb3qljIluf2l1eCFO+4627QucXK9qewAAAA== X-Change-ID: 20261112-sun8i-emac-mux-uaf-1ba885219fee To: Maxime Chevallier <maxime.chevallier@bootlin.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Chen-Yu Tsai <wens@kernel.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org>, Philipp Zabel <p.zabel@pengutronix.de> Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Arun Iyengar <aiyengar1990@gmail.com> X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1794461284; l=2672; i=aiyengar1990@gmail.com; s=20261110; h=from:subject:message-id; bh=NsburT4Rs6TuKeRLvNh9ntKMBycWNUHji+Gwj+018cs=; b=KuvZTvy/m2KLD0YOLU883uIqDNTznxKHAhJWD8davNR1BvQqXeosLyiPNYJbDYPG6qKvJDQdR LcFJgmVCqFeAlJD1ouD1bdILIdSCBHTVE1tYyniSitGLJ+rn/Vi2tK2 X-Developer-Key: i=aiyengar1990@gmail.com; a=ed25519; pk=zXpRgUTrhaFe6jLyPqbBy3ccfkj04w0g2690Wv3mg+0= X-Endpoint-Received: by B4 Relay for aiyengar1990@gmail.com/20261110 with auth_id=1480 X-Original-From: Arun Iyengar <aiyengar1990@gmail.com> Reply-To: aiyengar1990@gmail.com Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [-2.19 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[104.64.211.4:from]; SUSPICIOUS_RECIPS(1.50)[]; MAILLIST(-0.18)[generic]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; FREEMAIL_REPLYTO(0.00)[gmail.com]; FROM_HAS_DN(0.00)[]; TAGGED_RCPT(0.00)[netdev]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; HAS_REPLYTO(0.00)[aiyengar1990@gmail.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[sin.lore.kernel.org:helo,sin.lore.kernel.org:rdns]; RCPT_COUNT_TWELVE(0.00)[19]; FORGED_SENDER_MAILLIST(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,lists.infradead.org,lists.linux.dev,st-md-mailman.stormreply.com,gmail.com]; R_DKIM_ALLOW(0.00)[kernel.org:s=k20260515]; RCVD_COUNT_FIVE(0.00)[6]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc20261015:i=3]; DKIM_TRACE(0.00)[kernel.org:+]; DMARC_POLICY_ALLOW(0.00)[kernel.org,quarantine]; R_SPF_ALLOW(0.00)[+ip4:104.64.211.4]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[100.80.115.77:received,100.77.114.92:received,100.103.45.18:received]; TO_DN_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[devnull@kernel.org,linux-sunxi@lists.linux.dev]; FREEMAIL_TO(0.00)[bootlin.com,lunn.ch,davemloft.net,kernel.org,redhat.com,gmail.com,foss.st.com,sholland.org,pengutronix.de]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-27539-noreply=patchwork.local,aiyengar1990.gmail.com]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ASN(0.00)[asn:63949, ipnet:104.64.192.0/19, country:SG]; RCVD_TLS_LAST(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[104.64.211.4:from] X-Rspamd-Queue-Id: C6ACA1C7640 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: INBOX |
| Series |
[net] net: stmmac: dwmac-sun8i: Fix use-after-free in the MDIO mux error path
|
|
Commit Message
Arun Iyengar via B4 Relay
Nov. 12, 2026, 5:28 a.m. UTC
From: Arun Iyengar <aiyengar1990@gmail.com> mdio_mux_init() registers the child MDIO buses one after the other. Scanning the internal bus makes mdio_mux_syscon_switch_fn() select the internal PHY and power it, which sets gmac->internal_phy_powered. If mdio_mux_init() then fails without switching away from the internal bus, for example because registering the external bus returns -EPROBE_DEFER before any access to it, or because an allocation for it fails, sun8i_dwmac_probe() jumps to dwmac_mux with the PHY still powered. That error path releases gmac->rst_ephy and gmac->ephy_clk and only then calls stmmac_pltfr_remove(), which ends in sun8i_dwmac_exit(). Since the PHY is still marked as powered, sun8i_dwmac_exit() calls sun8i_dwmac_unpower_internal_phy(), which passes the clock and the reset control that were just freed to clk_disable_unprepare() and reset_control_assert(). Unpower the internal PHY before releasing its clock and reset control, as sun8i_dwmac_remove() does. The later call from sun8i_dwmac_exit() then does nothing because internal_phy_powered is already cleared. Fixes: 529254216773 ("net: stmmac: dwmac-sun8i: Balance internal PHY resource references") Cc: stable@vger.kernel.org Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com> --- The problem was pointed out by the Sashiko AI review of an unrelated dwmac-sun8i series of mine. It holds against the code: clk_put() and reset_control_put() free the per-consumer struct clk and the exclusive reset control, and nothing between the dwmac_mux label and sun8i_dwmac_exit() clears internal_phy_powered. This is build-tested only (arm64 and arm, W=1). I have no board with the internal PHY (H3, H5 or V3s), so the error path was not exercised. This patch was developed with Claude (Anthropic) as a coding assistant: it checked the report against the code and wrote the fix and the commit message. I reviewed it. --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 1 + 1 file changed, 1 insertion(+) --- base-commit: 145480b28ca82e9fae789427cc4569e596515a32 change-id: 20261112-sun8i-emac-mux-uaf-1ba885219fee Best regards, -- Arun Iyengar <aiyengar1990@gmail.com>
Comments
On Thu, Nov 12, 2026 at 05:28:05AM +0000, Arun Iyengar via B4 Relay wrote: > From: Arun Iyengar <aiyengar1990@gmail.com> > > mdio_mux_init() registers the child MDIO buses one after the other. > Scanning the internal bus makes mdio_mux_syscon_switch_fn() select the > internal PHY and power it, which sets gmac->internal_phy_powered. If > mdio_mux_init() then fails without switching away from the internal > bus, for example because registering the external bus returns > -EPROBE_DEFER before any access to it, or because an allocation for it > fails, sun8i_dwmac_probe() jumps to dwmac_mux with the PHY still > powered. > > That error path releases gmac->rst_ephy and gmac->ephy_clk and only > then calls stmmac_pltfr_remove(), which ends in sun8i_dwmac_exit(). > Since the PHY is still marked as powered, sun8i_dwmac_exit() calls > sun8i_dwmac_unpower_internal_phy(), which passes the clock and the > reset control that were just freed to clk_disable_unprepare() and > reset_control_assert(). > > Unpower the internal PHY before releasing its clock and reset control, > as sun8i_dwmac_remove() does. The later call from sun8i_dwmac_exit() > then does nothing because internal_phy_powered is already cleared. > > Fixes: 529254216773 ("net: stmmac: dwmac-sun8i: Balance internal PHY resource references") > Cc: stable@vger.kernel.org Does this bother anybody? Seems more like this should be for net-next. Andrew --- pw-bot: cr
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] net: stmmac: dwmac-sun8i: unhandled -EPROBE_DEFER in get_ephy_nodes() [1] -- commit 0e3757128b0330be69abe1ee1230d93499f349af Author: Arun Iyengar <aiyengar1990@gmail.com> net: stmmac: dwmac-sun8i: Fix use-after-free in the MDIO mux error path This commit unpowers the internal PHY on the sun8i_dwmac_probe() MDIO mux error path before releasing gmac->rst_ephy and gmac->ephy_clk so that the subsequent sun8i_dwmac_exit() call does not access freed resources. > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > index 47954537b29e4..4436532af2dce 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > @@ -1245,6 +1245,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) > return 0; > > dwmac_mux: > + sun8i_dwmac_unpower_internal_phy(gmac); > reset_control_put(gmac->rst_ephy); > clk_put(gmac->ephy_clk); > dwmac_remove: [Severity: High] This problem wasn't introduced by this patch, but does get_ephy_nodes() swallow -EPROBE_DEFER when acquiring ephy_clk [1]? drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c:get_ephy_nodes() { ... for_each_child_of_node_scoped(mdio_internal, iphynode) { struct clk *ephy_clk; ephy_clk = of_clk_get(iphynode, 0); if (IS_ERR(ephy_clk)) continue; gmac->rst_ephy = of_reset_control_get_exclusive(iphynode, NULL); if (IS_ERR(gmac->rst_ephy)) { ret = PTR_ERR(gmac->rst_ephy); clk_put(ephy_clk); if (ret == -EPROBE_DEFER) { of_node_put(mdio_internal); return ret; } continue; } ... of_node_put(mdio_internal); return -ENODEV; } Unlike the of_reset_control_get_exclusive() check right below it, an IS_ERR(ephy_clk) result unconditionally continues the loop without checking for -EPROBE_DEFER. If the internal PHY clock provider is not registered yet during boot, get_ephy_nodes() exhausts the child nodes and returns -ENODEV, causing sun8i_dwmac_probe() to fail permanently instead of deferring probe. [1] https://sashiko.dev/#/bug/linux-98384c14-541e-410e-a074-fff5e98b3820
> Does this bother anybody? Seems more like this should be for net-next.
No user report. Sashiko found it while reviewing another patch of
mine to this driver, and I have no board with the internal PHY to hit
the error path. I'll resend it for net-next without the stable Cc.
Arun
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index 47954537b29e..4436532af2dc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -1245,6 +1245,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) return 0; dwmac_mux: + sun8i_dwmac_unpower_internal_phy(gmac); reset_control_put(gmac->rst_ephy); clk_put(gmac->ephy_clk); dwmac_remove: