[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8994414a-07f3-425f-8b76-5d433ff4716f@linux.dev>
Date: Wed, 17 Sep 2025 11:47:08 +0100
From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
Richard Cochran <richardcochran@...il.com>
Cc: 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>,
Vladimir Oltean <vladimir.oltean@....com>, 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 16/09/2025 22:36, 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>
Now LGTM, shouldn't break our use-case, thanks!
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
Powered by blists - more mailing lists