🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12495

Re: [PATCH net] net: phy: micrel: Fix potential shared PHC use-after-free

#12495
From: Andrew Lunn
Date: Sat, 07 Nov 2026 14:40
23 lines
8993 bytes
On Sat, Nov 07, 2026 at 02:54:37PM +0800, Guangshuo Li wrote:
> The shared PHC outlives the first PHY's managed pin array and is not
> unregistered before the package data is freed. Subsequent PHC operations
> can therefore access released storage.
> 
> Keep the pins at package scope and select a remaining PHY for register
> access when a member leaves. Unregister the clock before releasing its
> storage on the last member's exit. Pair each member's registration with
> cleanup that also runs on probe failure, and serialize clock access with
> member removal.

You fix looks overly complicated. Ugly.

Try looking at it from a different direction.

.probe() and .remove() should be opposites of each other. What happens
if you do that?

    Andrew

---
pw-bot: cr
Technical Details
Message-ID: <71089325-dfab-45f7-9ebd-1feb65013863@lunn.ch>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358399-linux-kernel-netdev=dewy.ru
References: <20261107-0d0c29e10a-net-micrel-lan8814-1@mail.sdu.edu.cn>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358399-linux-kernel-netdev=dewy.ru
From: andrew@lunn.ch (Andrew Lunn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: phy: micrel: Fix potential shared PHC
 use-after-free
Date: Sat, 7 Nov 2026 15:40:45 +0100
Organization: Usenet Network
Message-ID: <71089325-dfab-45f7-9ebd-1feb65013863@lunn.ch>
References: <20261107-0d0c29e10a-net-micrel-lan8814-1@mail.sdu.edu.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="4121577"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:js5ziEeTXpBzID/fI+jccXC3pUE= sha256:HaIgthrBHOomT0RsL665xIHHz1bUJbFiiLKJx2IbRE0=
	sha1:QUleiVhO28TTkvUPJOYQR6rBm8I= sha256:dBEqsz/oG3rXAM+rrHYn3Nl/ZkbDdNVY8r50mTCqvDM=
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 2A3F611342E; Sat,  7 Nov 2026 17:46:17 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 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] 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 4MjnDTxiF6Sy;
	Sat,  7 Nov 2026 17:46:09 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-358399-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 1ED4A1133DF; Sat,  7 Nov 2026 17:45:58 +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 0AEDB3A7DA; Sat,  7 Nov 2026 14:42:46 +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=1794062473;
	b=hsBRsplOx03JybcPdpvCNonm9ppRNIFDThbtyIxfTbPNmzcnrEsibUXgy13XgmR7l8DA
	 wIKU/4pFn2x7pzcqtm/7ecNiSFP1vsZvKeDbhEK/3Ipj8ZG3zZXlYPPilTnBpVd/8m+Vg
	 w5/wUJ5uncwBJENR5B0DxwJGve9jsPyBLWjGIEayKk2/hOmEdIF/IQW5nKMJASgdFb9C+
	 CpV/Xa52+i5qRaAEL8Aq1HjE3+Ho5xj1fe0A/cRiLAIvVkMgAq4+A6M7iRMEE0aw+xIQD
	 v0w+CRAJeg4BW+2SROYf7hyJdD4a5KjDIYy2w+aRYMaBMv0m6FI4s6eK0fYAVhVy+gA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794062473;
	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=mAXBJnrefFBIzpyi+/xIAamlnKbGOaz7xXuvjQoOG20=;
	b=PPvCntzFma0WM0XvV6JYIZ0H1LRr6cqy9vGIoLpWokAO9w2b/1/i+ZfvKFMwixF/eoyd
	 H8ZuaABfhnsUuUpIp0Vx8viFC91gvHqwBPVgcjs8mMBoRCCEBrXGuR2zavr9bfQANjxvR
	 7S9acLB7beMtk4jY9i0EifwTIKrPBkMSDI/Swt7pRYO0d59h7HTw9pfxB21EsXvSM8hhV
	 vz71rGzdTfFa3BKmXbePbWvVEptBjW5SN01EA2e7uEWA/n2QEnBe4f8QU3Y+Wr3A7gQq7
	 d5iYbR+qkipWFfKjYzRJq8OpLbSLkYZwyOMRxiDCtfPsm2e9rC/LNDR1CC1kDdEMyrw==
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=niaecTAq;
	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 EA861606A32D;
	Sat,  7 Nov 2026 14:41:12 +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=niaecTAq
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=1794062467;
	b=fzbeSJzeCIiTZ24fjT5NJ17OIp5tkTrtHvWhiGKra0+p+wUAM4943IKCK//buUCSYuOy
	 VItIJQkDzsjvCmih4Vn5+Ai7DQwg+Lk/RimSS/5j0IylNE6JkGPNrQlKZll4vvxEQ/oFU
	 OxlNK3ZQ98kLzbEJ3hIkTKu2VNpHVjuROxvTNemft7NxMi5R5chlEN1GZfMD9zdCeclF8
	 6P7p68LfVKlUXm5rLD/8/AJHy2spBOZcpBqlQBcxY6zN9hZKdFN8s8sDfohXhWPd1vNhY
	 eetZz2x+Horer92f2pn1d9fqY2whtB6vLq2jPMmZpGoyJDzy76WCsoXumUDHBeRTcFQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794062467;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=mAXBJnrefFBIzpyi+/xIAamlnKbGOaz7xXuvjQoOG20=;
	b=g2+gsvN+FRGOI7cLyBKbSahgYxWxDUDtJvM5ROq37W/e3Nmr048jACS9NxAZWCSmEaw1
	 kl5d5pHQq3nj8f0nSW0+PbNwJCn7hOFeKmxYhAePqsUrWBF96ysrYPAHtCXf1RlFIeY1e
	 DiEmFkxfsV2906wv+UUrWcYXBIGqJWDtNpceu9RFSgwBH5F9VaeM1qVqwGNpAKjldWWW3
	 VA5qJaz7AK2AUEapUZ0VqOFowkW4smHaTCt2rKRY4WJkzvuV2AuqCbuHWhWSKu5hcA76X
	 nfZXv4V+kHgYOSXzUl87lZ2um2BjeWLZ09HRtuHgj1jzdcMfdDFPbby/CzI7c/42C7A==
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=niaecTAq;
	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 08D8F606A65A;
	Sat,  7 Nov 2026 14:41:05 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 08D8F606A65A
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=mAXBJnrefFBIzpyi+/xIAamlnKbGOaz7xXuvjQoOG20=; b=niaecTAqavwtL7dI0lyUOAqyEa
	E58LYVcaKACZDTdDNLvCDFX3YlqOIU6vX9zKMiB4BtXy4nKBNcAbltCwU4/PVmekWfZ+wCRBLRZRv
	zH4e8VyCRBkPd4bEUo4vHUR/nRdIEYheiTNYbWVOpTvkeFhxvE3tDs55MrSjP/5M/k0w=;
X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2)
	(envelope-from <andrew@lunn.ch>)
	id 1xPhb3-00Ey67-7L; Sat, 07 Nov 2026 15:40:45 +0100
X-Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, 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: <20261107-0d0c29e10a-net-micrel-lan8814-1@mail.sdu.edu.cn>