Thread (7 messages) flat view 7 messages, 6 authors, 2025-09-17

Re: [PATCH net-next v2 2/2] ptp: rework ptp_clock_unregister() to disable events

From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Date: 2025-09-17 10:47:16
Also in: imx

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) <redacted>
Now LGTM, shouldn't break our use-case, thanks!

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help