mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
ptp: idt82p33: Stop PTP work producers before teardown
idt82p33_ptp_clock_unregister_all() cancels each channel's adjtime work before unregistering its PTP clock. An adjustment callback already in progress can schedule that work after cancellation returns. Device removal then frees the channel while its delayed work remains queued, causing a use-after-free. Mark the device as stopping under its lock before draining work. Reject new adjustment and EXTS requests, clear the EXTS polling mask, and synchronously drain the EXTS and channel adjustment work before the device storage is released. With an i2c-stub device and kprobe-controlled callback timing, three runs of the unmodified driver reported KASAN use-after-free after unbind. Three runs with this change completed without a kernel diagnostic. No physical IDT82P33 device was tested. Cc: stable+noautosel@kernel.org # untested fix to a driver init path race Signed-off-by: Yibo Tan <lhfff@tju.edu.cn> Link: https://patch.msgid.link/20260922113601.855416-1-lhfff@tju.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
e3a46dde23
commit
a529f9258d
2 changed files with 22 additions and 4 deletions
Loading…
Add table
Add a link
Reference in a new issue