Article View: linux.kernel.netdev
Article #19157Re: [PATCH net 1/2] net: phy: restore timestamping state on probe failure
From: Andrew Lunn
Date: Thu, 19 Nov 2026 13:23
Date: Thu, 19 Nov 2026 13:23
50 lines
10293 bytes
10293 bytes
On Wed, Nov 18, 2026 at 05:34:05AM -0500, Kimberly Morris wrote:
> A PHY driver can install a devm-backed mii_timestamper and select it as
> the default before its probe sequence has completed. If a later probe
> step fails, the driver core releases the driver's devres, but the
> phy_device retains both timestamping fields.
>
> If the generic PHY driver later attaches, skb_defer_rx_timestamp() can
> dereference the freed mii_timestamper. This also affects non-PTP packets
> because the receive path tests hwtstamp_set before classifying the
> packet.
This is very theoretical. It means root has unloaded the device
specific driver leaving just genphy. Very unlikely.
> Fixes: 39db6be781cd ("net: phy: broadcom: Add PTP support for some
> Broadcom PHYs.")
> Cc: stable@vger.kernel.org
Since this never happens, it bothers nobody, net-next.
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -3812,8 +3812,10 @@ EXPORT_SYMBOL_GPL(fwnode_get_phy_node);
> static int phy_probe(struct device *dev)
> {
> struct phy_device *phydev = to_phy_device(dev);
> + struct mii_timestamper *mii_ts = phydev->mii_ts;
> struct device_driver *drv = phydev->mdio.dev.driver;
> struct phy_driver *phydrv = to_phy_driver(drv);
> + bool default_timestamp = phydev->default_timestamp;
> int err = 0;
>
> phydev->drv = phydrv;
> @@ -3951,6 +3953,9 @@ static int phy_probe(struct device *dev)
> phydev->drv->remove(phydev);
>
> out_reset:
> + phydev->mii_ts = mii_ts;
> + phydev->default_timestamp = default_timestamp;
> +
The basic fix is wrong. If probe fails, everything done so far should
be undone. When probe is entered, there is no stamper. If probe exists
with an error, there should be no stamper.
Andrew
Technical Details
Message-ID:
<c1075f39-c0b2-44cd-9338-b3506419f685@lunn.ch>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367022-linux-kernel-netdev=dewy.ruReferences:
<CAD-64DdqQ=Vx4BaRn5TXz0g5ZC6rU9+e0o-rouyXzGH=Nv0ubQ@mail.gmail.com> <CAD-64Dfm-2U=1f3b7y3K-B3q_mijQ0xypqUEDt7o+q7Tmxx_hw@mail.gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367022-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 1/2] net: phy: restore timestamping state on probe failure Date: Thu, 19 Nov 2026 14:23:37 +0100 Organization: Usenet Network Message-ID: <c1075f39-c0b2-44cd-9338-b3506419f685@lunn.ch> References: <CAD-64DdqQ=Vx4BaRn5TXz0g5ZC6rU9+e0o-rouyXzGH=Nv0ubQ@mail.gmail.com> <CAD-64Dfm-2U=1f3b7y3K-B3q_mijQ0xypqUEDt7o+q7Tmxx_hw@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="2881264"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:5OvJe96ceUcPJs2+ms/qkFNMDb4= sha256:CM6AhewBXEy3A6Fu8bqXQJlNE1zIR344pZu6G0YqKGA= sha1:tqaIcLCVZ2j6jhnh/1igHFrCuI8= sha256:+rlvOym/+kHXBqOmwwDnwKFAoNAF+GuyolNujvFGuDA= 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 0628C115659; Thu, 19 Nov 2026 16:25:23 +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 9ijhTqCc0Q4G; Thu, 19 Nov 2026 16:25:16 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-367022-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id B0A1611562D; Thu, 19 Nov 2026 16:25:06 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 37FF41C134D; Thu, 19 Nov 2026 13:23:55 +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=1795094633; b=Z9qVZCfDewFWPrZ+/UbtFf+H1KW+vIQNaW16VJ/4nKYBMUSBk+WjSZBpnQNWIsUFZJlo jj7V4MIXb23IDpG6olagFytpkyUE+OX17SYNKhdwnXHyTY2NGf1xLdzehyrom3rErO7qC kju33J02J4aqZTeVuj4NpVjlcmRnSdjrXoCj1zyTmreEEz+p1j3WMUDcLHllj2LNH7xXZ Hdq3rfpn7IbEUsUARBajD69J8U/AeXkeWU4dAjsSjqtk+Xms0nWsV6Qe/bjHZhftZL/ri J17tYO+8qtJMCId4V2ePGYCrc2mYexBraE/YAahoqtR6Kt+gBiN4iVOTxHI9ZcT/A2A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795094633; 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=s2+EYN3sHV8P8LXqUrZ7kjnHvhCP958pbz5KmfU2vD8=; b=CcmLFsXyLWVwIwWhimqVDD0JXEI4asOX5w0Wiit2OFcDmyz9Pkl1bdmKaCannKM6l8IV JIUP91EDE/to5Ypuk6DxRxFjuRWTSIJZFYkagdTidWbxn/efPzX/5NDdzM9V+y3FSDFU1 cov00EGrO6z+JbJTu7G72wVo7YSFT5TVBcz0a8SzthmPOpwqaLovs7qdZahxZexSVECX7 vV0xrzz8bSbS3uX/bytYdKYc4jMd8fWC239fZFWroUtzmp6itu0M8zIhDEik6XWMdJcKX I4PNf4wU0/atNATxz0/01Y//ine1ZreQpNRdo9TLJpYgwlJ3eHtc07daFVNjkMjm8MQ== 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=Qo3ivrTk; 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 69D40606A334; Thu, 19 Nov 2026 13:23:53 +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=Qo3ivrTk 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=1795094632; b=l4LXBAXL/3rH4MSZEhV6f0ylu5MBPMoqu109nw6RHCGt4L6IpwGnDoH94SN6sWmcY3aR CDJX4wsyctARf6pdwCl7wpbXuc6mXJj/fAiP6iE7qbMXWXBnUNuBvAg7Y9I5zi6o0XTCs vmXbzcZrdXBFdy9Qx1lGYr8CLA+vOlOd/ZYlLKsn9+kwB88aQH5Xp9l6+UuZMRIFW8z4Y pweaoL4/ad1hVd2tb+5nPPmZd76CNN38wlDYTFkOtZA2kdeDX6vGs3DbJ7Dsf0e7Klk02 qfe/YWZHCaa1OuDXpubuy1JjxgTQ8zQpKYDng9kyZoZMHFSdQjahytvUbwbAeN2DjGA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795094632; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=s2+EYN3sHV8P8LXqUrZ7kjnHvhCP958pbz5KmfU2vD8=; b=NMb89g8SFeKy8Olo2E10q83fxIA1o3QJ7EsXbV343mB3zAFYwxPyJFL0B5pZ+plujXi6 JK4dw7p8ob5yc0qFtF3SBNMyJwtigcW83Exu4ikBOPFnE4e7Xzi5Bnk7cvy6vKV9u5EpG xwwvQFZeetO0NU+J1ZkuufMgjMBuDEa1hglkkLzuavIiTm41wyjEXdvHW4TjC7A0+2d48 FvFNHGhpObE071iZnbTLqx+p09UvAsE/6AEIHqPVaoY1H5RbZsI/2SdxU0Dp7biJ224QU i7kAh83oaVV6GD5frI/QDieU6bLM62Fn6Wr0fv4Jhd3rEC7RBjAxyh8qkBYEnzVHzKg== 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=Qo3ivrTk; 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 3DF69606A320; Thu, 19 Nov 2026 13:23:52 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3DF69606A320 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=s2+EYN3sHV8P8LXqUrZ7kjnHvhCP958pbz5KmfU2vD8=; b=Qo3ivrTkacjLjqNCO1bTwzJ/HJ wn+By5ghNC4evcpzV74ukvBuckxGYwHxmI+aLzmPyU+R4wFGW5xRcc5Feh2AqUVb9YaDpbRBoFj6k 94OMDXbbTL7VnSIMnqtKv4JkYOMST4bUR6gb3GjqqXyRDQ8l1j+awxneBoXczyfWm5OU=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xU26z-0002Ml-AJ; Thu, 19 Nov 2026 14:23:37 +0100 X-Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, florian.fainelli@broadcom.com, bcm-kernel-feedback-list@broadcom.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, w@1wt.eu 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: <CAD-64Dfm-2U=1f3b7y3K-B3q_mijQ0xypqUEDt7o+q7Tmxx_hw@mail.gmail.com>