From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
Richard Cochran <richardcochran@gmail.com>
Cc: Ajay Kaher <ajay.kaher@broadcom.com>,
Alexey Makhalov <alexey.makhalov@broadcom.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Clark Wang <xiaoning.wang@nxp.com>,
"David S. Miller" <davem@davemloft.net>,
David Woodhouse <dwmw2@infradead.org>,
Eric Dumazet <edumazet@google.com>,
imx@lists.linux.dev, Jakub Kicinski <kuba@kernel.org>,
Jonathan Lemon <jonathan.lemon@gmail.com>,
netdev@vger.kernel.org, Nick Shi <nick.shi@broadcom.com>,
Paolo Abeni <pabeni@redhat.com>,
Sven Schnelle <svens@linux.ibm.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Wei Fang <wei.fang@nxp.com>, Yangbo Lu <yangbo.lu@nxp.com>
Subject: Re: [PATCH net-next v2 2/2] ptp: rework ptp_clock_unregister() to disable events
Date: Wed, 17 Sep 2025 11:47:08 +0100 [thread overview]
Message-ID: <8994414a-07f3-425f-8b76-5d433ff4716f@linux.dev> (raw)
In-Reply-To: <E1uydLH-000000061DM-2gcV@rmk-PC.armlinux.org.uk>
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@armlinux.org.uk>
Now LGTM, shouldn't break our use-case, thanks!
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
next prev parent reply other threads:[~2025-09-17 10:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 21:35 [PATCH net-next v2 0/2] ptp: safely cleanup when unregistering a PTP clock Russell King (Oracle)
2025-09-16 21:35 ` [PATCH net-next v2 1/2] ptp: describe the two disables in ptp_set_pinfunc() Russell King (Oracle)
2025-09-16 21:36 ` [PATCH net-next v2 2/2] ptp: rework ptp_clock_unregister() to disable events Russell King (Oracle)
2025-09-17 8:38 ` Vladimir Oltean
2025-09-17 10:47 ` Vadim Fedorenko [this message]
2025-09-17 14:47 ` [PATCH net-next v2 0/2] ptp: safely cleanup when unregistering a PTP clock Richard Cochran
2025-09-17 22:20 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8994414a-07f3-425f-8b76-5d433ff4716f@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=ajay.kaher@broadcom.com \
--cc=alexey.makhalov@broadcom.com \
--cc=andrew+netdev@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=dwmw2@infradead.org \
--cc=edumazet@google.com \
--cc=imx@lists.linux.dev \
--cc=jonathan.lemon@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nick.shi@broadcom.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=svens@linux.ibm.com \
--cc=vladimir.oltean@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.com \
--cc=yangbo.lu@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.