[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250917083801.xbdfkkcotjphulfm@skbuf>
Date: Wed, 17 Sep 2025 11:38:01 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc: Richard Cochran <richardcochran@...il.com>,
Ajay Kaher <ajay.kaher@...adcom.com>,
Alexey Makhalov <alexey.makhalov@...adcom.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
Clark Wang <xiaoning.wang@....com>,
"David S. Miller" <davem@...emloft.net>,
David Woodhouse <dwmw2@...radead.org>,
Eric Dumazet <edumazet@...gle.com>, imx@...ts.linux.dev,
Jakub Kicinski <kuba@...nel.org>,
Jonathan Lemon <jonathan.lemon@...il.com>, netdev@...r.kernel.org,
Nick Shi <nick.shi@...adcom.com>, Paolo Abeni <pabeni@...hat.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Wei Fang <wei.fang@....com>, Yangbo Lu <yangbo.lu@....com>
Subject: Re: [PATCH net-next v2 2/2] ptp: rework ptp_clock_unregister() to
disable events
On Tue, Sep 16, 2025 at 10:36:03PM +0100, Russell King (Oracle) wrote:
> The ordering of ptp_clock_unregister() is not ideal, as the chardev
> remains published while state is being torn down, which means userspace
> can race with the kernel teardown. There is also no cleanup of enabled
> pin settings nor of the internal PPS event, which means enabled events
> can still forward into the core, dereferencing a free'd pointer.
>
> Rework the ordering of cleanup in ptp_clock_unregister() so that we
> unpublish the posix clock (and user chardev), disable any pins that
> have EXTTS events enabled, disable the PPS event, and then clean up
> the aux work and PPS source.
>
> This avoids potential use-after-free and races in PTP clock driver
> teardown.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> ---
Reviewed-by: Vladimir Oltean <vladimir.oltean@....com>
Tested-by: Vladimir Oltean <vladimir.oltean@....com> # ocelot, sja1105, netdevsim, vclocks
Powered by blists - more mailing lists