Article View: linux.kernel.netdev
Article #13193Re:Re: [PATCH net] net: phy: micrel: Fix potential shared PHC use-after-free
From: 李广硕
Date: Mon, 09 Nov 2026 13:05
Date: Mon, 09 Nov 2026 13:05
33 lines
11405 bytes
11405 bytes
Hi Andrew, From: Andrew Lunn <andrew@lunn.ch> Date: 2026-11-07 22:40:45 To: Guangshuo Li <liguangshuo@mail.sdu.edu.cn> 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 Subject: Re: [PATCH net] net: phy: micrel: Fix potential shared PHC use-after-free>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 > On LAN8814, one PHY registers the shared PHC and owns its pin array. If that PHY unregisters the clock in .remove(), the clock goes away before the pins are freed. If another port is still bound, it loses access to the PHC. I added the handoff in v1 to keep the clock available in that case. I'll rework this around the PHY that registered the clock. I'll check how the remaining ports report the PHC after that PHY unbinds, and what happens if it binds again while another port is still up. Thanks, Guangshuo
Technical Details
Message-ID:
<AHAASAAGLPGJfVjn9skPJKoS.3.1794229559658.Hmail.202321181@mail.sdu.edu.cn>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359304-linux-kernel-netdev=dewy.ruReferences:
<20261107-0d0c29e10a-net-micrel-lan8814-1@mail.sdu.edu.cn> <71089325-dfab-45f7-9ebd-1feb65013863@lunn.ch>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-359304-linux-kernel-netdev=dewy.ru From: liguangshuo@mail.sdu.edu.cn (李广硕) Newsgroups: linux.kernel.netdev Subject: Re:Re: [PATCH net] net: phy: micrel: Fix potential shared PHC use-after-free Date: Mon, 9 Nov 2026 21:05:59 +0800 (GMT+08:00) Organization: Usenet Network Message-ID: <AHAASAAGLPGJfVjn9skPJKoS.3.1794229559658.Hmail.202321181@mail.sdu.edu.cn> References: <20261107-0d0c29e10a-net-micrel-lan8814-1@mail.sdu.edu.cn> <71089325-dfab-45f7-9ebd-1feb65013863@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: base64 Injection-Info: usenet.network; logging-data="361575"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:HAQKHaLu6AO+jnA/K0XHJEonZBA= sha256:rAzoNUZZQNFbUvuBh9Dp9asEkn9sqWrHbMEfuydfpOQ= sha1:Y4R22ckILYkqbNlYoE9Gyj2B6pQ= sha256:2XknBjz6jx1w6HbDVEf4N4/DOfQ4r62EO+dQf8WbiaI= 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 A60361137E9; Mon, 9 Nov 2026 16:10:41 +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, MSGID_FROM_MTA_HEADER=0.001, 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=mail.sdu.edu.cn 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 Ca9n803vrbuM; Mon, 9 Nov 2026 16:10:35 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-359304-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=mail.sdu.edu.cn X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 2B0D711378E; Mon, 9 Nov 2026 16:10:26 +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 BA60A3023B; Mon, 9 Nov 2026 13:06:18 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1794229572; b=KmVOetFdf8thC1l9gckebl8zK/9NeaHEr2b+/iAXbPOa7nr33p1Rwj3ZPX477M90mbx8 9mZPMKGzc7OywH1czsvZLYTfCqI7QRVKTffqww+AcuaDjD2yHc63qc9epPEZYs+rMIUIL FX3OMgbIuck9XQU/Q8Iv+4UpzjtPxXaPeXJ2qvbos/dZczC2pQGYVqmI1kGsiYt3xuGov Mfqr4izek90XtWuWi4+Q7/lHUU7AHs7U4e+4FMvClEkZUpenHYSINgCy2EDplJfP1TT/N d+BUAV71bBM9f0BcXdhJxFQbqXFOB/fPpdeZgbR4SzQr7mIVS2OeCPH473yAT3Qx/HA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794229572; h=X-Original-To:Received:DMARC-Filter:Content-Type: Content-Transfer-Encoding:Message-ID:To:Cc:Subject:X-Priority: X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Received:From:Date:X-HM-Tid:X-HM-MType:X-HM-NTES-SC: X-HM-Spam-Status:DKIM-Signature; bh=Uwx411kQ+pLsLGYRN6fUT/Mj26SB4GKvUWvjQbIK0qs=; b=1mTzCW9ZI7ZDyjr/nAidL8ORDW3oY48w21GQrevbVRTYr3PZJr1xfTEaHrEQRyEMAEty KdiogN+Meafm98V5qIXVT080c88qX0S+YvBvh+TZavNShYwMUhNajNOIVTaK8iFmOUbLz tzXzZmlprPu1AcdBY39RgkeWKI+N1ciY10ItEFs9KP4xsxwxst6ticZLVv98euxVPLwvb SdFrK8ZgzyTdPp1d9clA0MZ1GN76Nv/0wNxaEl14ZP8bVG+STrrxaUgp34ZLE0ghsZ6fU QnO1mR60++5JoxN6zvLPj/JUXgw8fmadFrD/KwFLe2Z/f4LvgoHfimrjRr3TCpJDd4Q== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=mail.sdu.edu.cn header.i=@mail.sdu.edu.cn header.a=rsa-sha256 header.s=default header.b=c24RGP0w; dmarc=pass header.from=mail.sdu.edu.cn; spf=pass smtp.mailfrom=mail.sdu.edu.cn; arc=fail 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 2DA8A606A331; Mon, 9 Nov 2026 13:06:12 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mail.sdu.edu.cn header.i=@mail.sdu.edu.cn header.a=rsa-sha256 header.s=default header.b=c24RGP0w X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=210.79.60.68 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794229566; b=V8rdVb+l0gAlG3QUbXPPHoYzf1yUT/zH6797Q9fbT8VlhHgILWu/L0oOb9XpIvPhoUvi cF7Mzjw0+Y0ewt7l7ImgMvDEGNwh6clXWYj1N7mHFMbkAzDdvIPwUb+q82kMgUGsJXlTz /Zz+Sx6wSCSfJv2cCM8zxO3Uqdhi90mmJQxjy3MUiV/Ksn33E6ILw/EcBj0nTRgjQmjOY YGqPusiGrOWQW4wSRNKMMumY5sx92WnFk0qyUAL0TQcsX1Of+4Zft7+V+8DgYCV3aya7/ lV0OtYBLVwvWhpBcyu2fZJVQPeuUQrjXlXqZgGhsgiVt0DC2e+w57veM1TXj1grA54A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794229566; h=DMARC-Filter:Content-Type:Content-Transfer-Encoding:Message-ID:To:Cc: Subject:X-Priority:X-Mailer:X-Originating-IP:In-Reply-To:References: MIME-Version:Received:From:Date:X-HM-Tid:X-HM-MType:X-HM-NTES-SC: X-HM-Spam-Status:DKIM-Signature; bh=Uwx411kQ+pLsLGYRN6fUT/Mj26SB4GKvUWvjQbIK0qs=; b=Ekq/vg9jo0fQzQr6zh+xHHDxaSdp7hVDi64IXeqOmEZHK+hjhGjVGgZHrwyaRfURVaAq 46diTUOLY7WVHPc5KlXVLN3x82K248puzgHieMKHy7ZVCybOz7gXQJNogL7Sd0dInea5i zWnt/N2VySS4ZY8XQnDptDeTFfK1LghGef6VBQSDsh4g0rbW8kSBU7qJ3FzDsfqhKE9PI yRUy8gL2Oaj17TkOHs4KBiFmTu4k9+cJwWTD3O2g00KsFlLXGHUO1NUVj2BTy6XNBB/CE qqfzjmWS7f7fF1gfG1Sou/HMiZmtWstGgdnAM8nsgQS+l79lfkTQK0I6KkE2B0psROQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=mail.sdu.edu.cn; spf=pass smtp.mailfrom=mail.sdu.edu.cn; dkim=pass header.d=mail.sdu.edu.cn header.i=@mail.sdu.edu.cn header.a=rsa-sha256 header.s=default header.b=c24RGP0w; arc=none smtp.remote-ip=210.79.60.68 X-Received: from mail-m6068.netease.com (mail-m6068.netease.com [210.79.60.68]) (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.subspace.kernel.org (Postfix) with ESMTPS id 8E46E606A321; Mon, 9 Nov 2026 13:06:03 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8E46E606A321 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mail.sdu.edu.cn X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mail.sdu.edu.cn 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-Priority: 3 X-Mailer: HMail Webmail Server V2.0 Copyright (c) 2016-163.com web X-In-Reply-To: <71089325-dfab-45f7-9ebd-1feb65013863@lunn.ch> 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-Received: from 202321181@mail.sdu.edu.cn( [101.76.249.61] ) by ajax-webmail ( [127.0.0.1] ) ; Mon, 9 Nov 2026 21:05:59 +0800 (GMT+08:00) X-HM-Tid: 0aa1c068f344d0cdkusy32cfb2e0ea97 X-HM-MType: 1 X-HM-NTES-SC: AL0_4z5B86Wr4Tz9jdMF+bhXMVHpP02bZAKsMEiErRSAekjx+ys+KNZNl0PLwl f2MeqR5lbiqKsoq8sm3hZVy9q3VY0Ca69y1LOfMeXKdLfI1E5i1eQoqSDNKmzdVlKZstM3zMatiP 6f2nKh8VfvidlmoN6FW855umPHcnkTFehqKqk= X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVlDHhhKVktIHhhDShpLSksdH1YVFA kWGhdVEwETFhoSFyQUDg9ZV1kYEgtZQVlKS0pVTE1VSU9CVU1KWVdZFhoPEhUdFFlBWU9LSFVCQk lOS1VKS0tVSkJLQlkG X-DKIM-Signature: a=rsa-sha256; b=c24RGP0w8GS1kFlMgpeIV4goy0/fiBcfsRhdX8M7EE6Rx0KfYRRZ0miTjZgw3bZBWhWbZRq/IKlF2x0yBeDImPT+PORQF6vs8CHzhLW/PzXtyHrYIM1JUHoyqZg16/KlzZM53qp8XgFAYIsc6e43m2TE8cRRQK8wwM2sqRquBfo=; s=default; c=relaxed/relaxed; d=mail.sdu.edu.cn; v=1; bh=Uwx411kQ+pLsLGYRN6fUT/Mj26SB4GKvUWvjQbIK0qs=; h=date:mime-version:subject:message-id:from;