🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16460

Re: [PATCH net-next v2] net: stmmac: dwmac-sun8i: Fix use-after-free in the MDIO mux error path

#16460
From: Andrew Lunn
Date: Sat, 14 Nov 2026 21:45
31 lines
9963 bytes
On Fri, Nov 13, 2026 at 07:55:00AM +0000, Arun Iyengar via B4 Relay wrote:
> From: Arun Iyengar <aiyengar1990@gmail.com>
> 
> If mdio_mux_init() fails after the scan of the internal bus has powered
> the internal PHY (the external bus returns -EPROBE_DEFER, or an
> allocation fails), the dwmac_mux error path puts rst_ephy and ephy_clk
> and then calls stmmac_pltfr_remove(). sun8i_dwmac_exit() then unpowers
> the PHY through the clock and reset control that were just released.
> 
> Unpower the internal PHY before releasing them, as sun8i_dwmac_remove()
> does.
> 
> Fixes: 529254216773 ("net: stmmac: dwmac-sun8i: Balance internal PHY resource references")
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
> ---
> Sashiko's review of another dwmac-sun8i series of mine pointed this
> out. 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), which checked the
> report against the code and wrote the fix and the commit message. I
> reviewed it.
> ---
> Changes in v2:
> - Target net-next instead of net, drop Cc: stable (Andrew Lunn)

Maybe i was not explicitly, sorry. If it is for net-next, it should
not have a Fixes: tag.

	Andrew
Technical Details
Message-ID: <f4a0dbf2-4266-4397-a1f5-62b1bc7f3fb2@lunn.ch>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363469-linux-kernel-netdev=dewy.ru
References: <20261113-sun8i-emac-mux-uaf-v2-1-6203666b2687@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363469-linux-kernel-netdev=dewy.ru
From: andrew@lunn.ch (Andrew Lunn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2] net: stmmac: dwmac-sun8i: Fix use-after-free
 in the MDIO mux error path
Date: Sat, 14 Nov 2026 22:45:49 +0100
Organization: Usenet Network
Message-ID: <f4a0dbf2-4266-4397-a1f5-62b1bc7f3fb2@lunn.ch>
References: <20261113-sun8i-emac-mux-uaf-v2-1-6203666b2687@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="1670349"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:DdVBi7Klfj9jJdcofZuBlkkSKiQ= sha256:gkg9EyKjYMkTqbIE9YT3f1g4kZyhU6MQuJ4BGbNWONs=
	sha1:XWWo8AzrgjRboY5pvfMDQUOwfbQ= sha256:gJGERIrKntqYz7mmeo+wbZVJe6GhPmIshzhR2mMXCmQ=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id DD2F71148B8; Sun, 15 Nov 2026 00:46:28 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=lunn.ch
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id tvfLHKpM5uEa;
	Sun, 15 Nov 2026 00:46:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-363469-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 14D21112024; Sun, 15 Nov 2026 00:46:15 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 8A1A1398F5; Sat, 14 Nov 2026 21:46:08 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794692765;
	b=0Gzy3khaToasvt6dE3pf5tWmHD49Ej+KIZdzbX1G9yX9K6Szo0Wv+QxBwp+PwdUUvCdl
	 ocBMQMcgTfQs8jHve57/KYCwEcgpmNpFT0MKVKuQEJPpM37kv4fVdvz7VYA+z1cMrvYcY
	 g9SAJwC3Fle65P2YRWgVe0tmTWy8oUp/sh2TPOvIzb7wT/fWmT+u/O1bjCm19kENKcSix
	 jxVei4fm/FwlfP4Ai2YyB50AGeqeGfkkMRsleNJRtKi406oa0EowIIbwXBj/mK4F0h1TA
	 bh63m+1l+OxSCgB8gGbNK43BmZQ5VEX8S4cOzjXin+0kH7kJ6U+My7zn0V+rBs5fd5A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794692765;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date:
	 From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=gqg88/emFc38P4J1Mas5qTG5S+BH3tBGNUdqoIHsm7I=;
	b=U02SiHPSakzJbfBevMOPeFSwj7+vgLIgdgTBdiecRWWuQ7rQYEJCXXwRcEFdCA0zBBoF
	 2vXGNTix3pUrEPNhtWURsnUSmVkszcot2DxXcXR/G80QrAFWFY+YXPSCYP0oLsOCrVtkw
	 eja2iz0rNDFL2V6X6fD96GPEC9injCeE6ggfb/2UX5laCUrHS4Ljlvs5tAd1KQXKwKANO
	 mL6wGMh6Zwg9BXaFQXWdJJKxuV0lbCy6fvKjKZVuSgGsS46AJumWyGE0S39G+UdHCkh2w
	 WTY11XvhGA7WJNaLeyW1dnBQkIcCBlB1mKu7cUgvUHOPH7t9ePsVmwapSCFov5pItmw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=R4aioWO4;
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id EBD84606A339;
	Sat, 14 Nov 2026 21:46:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=R4aioWO4
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794692764;
	b=KtuaVfsIHMBZBAyxJm/kZs1z1Qgqx4fTp95ctGkMAQwV2EqZcPdA3mbV8XWGOM3jTjrF
	 Pzx4z8AOTzRXIriupdW3UctO45LOyUJLSebI21p9T6RS+5l5kRq/AW5XSpxcn8Ay/Q4dz
	 jIocA7TjcujmdYakDRZwA6wjoxONyhhzNkfHeiy+gjAT9Put9AZhjMdcOVn/JMJEJjHIO
	 F8UU4a5xsXNZ6jJNrlynyDqGbYRUmBy0m4nyMkybSh/wV7HxlMmK/l/cxKPH34aNT2gA4
	 Ji3+C5is7gRityqV5BtEUyMUXZ5fA5RoGoxVAjEXi+CGFdHcLUZwjVsHyaju6NV4i4w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794692764;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=gqg88/emFc38P4J1Mas5qTG5S+BH3tBGNUdqoIHsm7I=;
	b=bvwscu6/rsonQnRD+8u8OJ/PPM2OYWKFomRmio5q4Q4/LsIxKukVtCJ831kfomP7hhuv
	 MWFvZ6pwdaN9CYBbMEWgZi8mTDM66Py0cgNK36iOjzzGtZ0Dn1vKR1AHES40uKjZnvjyM
	 +395GWA6gK6abEwLHgYmjiOb7xMAo1757+PQd7jThhRGmYz8NwdWj2HGnjA7S5PHnJgIu
	 LuPPhlVIlCQlgucFLohPbuZL8d/f6g5kgBtT6OfSMdgQYIG1GpqAlGLOCb19LWvt1J6Pt
	 aemskW/wE3NWUEckEnWayBDyAsLhWLjOqTxnoExUrt2TZRSQ6C3OGWZD9B91LqaZNRQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=R4aioWO4;
	arc=none smtp.remote-ip=156.67.10.101
X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1140606A323;
	Sat, 14 Nov 2026 21:46:03 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C1140606A323
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch
X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch;
	s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version:
	References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject:
	Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:
	Content-ID:Content-Description:Content-Disposition:In-Reply-To:References;
	bh=gqg88/emFc38P4J1Mas5qTG5S+BH3tBGNUdqoIHsm7I=; b=R4aioWO4OX11sBMgPDbwz90NWc
	G4oO/MrOZDziirRTPzZZ+D4atniVjcEpLbQIrlXlHHDSQjRmO/2hJRVdqs+pVo+mEBI6hI5S8D69C
	TgJVL0UclzH3qecoZ8IY9wmP6ZlLsl9c3yGycBo7Rztnl/4dUI4F0R4QsqslbT5UhSRs=;
X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2)
	(envelope-from <andrew@lunn.ch>)
	id 1xSLZF-00GXW7-O7; Sat, 14 Nov 2026 22:45:49 +0100
X-Cc: 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>, 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
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261113-sun8i-emac-mux-uaf-v2-1-6203666b2687@gmail.com>