Re: [PATCH net v2] ptp: vmclock: keep the device state until the last file is closed
From: Jakub Kicinski
Date: Wed Nov 18 2026 - 21:16:58 EST
On Thu, 12 Nov 2026 16:15:27 +0000 Chad Aldreda wrote:
> vmclock_probe() allocates struct vmclock_state with devm_kzalloc() and
> maps the shared page with devm_memremap(), so both are released when
> the driver is unbound, but an open /dev/vmclockN keeps using them
> through its file state. After an unbind, read() runs on the freed
> struct and reads through the released mapping, and a poll() in
> progress sleeps on a wait queue in the freed struct. KASAN reports a
> slab-use-after-free in vmclock_miscdev_read(). In testing, the same
> read() faulted on the unmapped page once the device had been bound
> again.
this patch needs a rebase after recent mass rename of kmalloc
--
pw-bot: cr