Re: [PATCH v1] fs_pin: do not trust the pin after a spurious wakeup in pin_kill()

From: Christian Brauner

Date: Fri Oct 30 2026 - 12:14:28 EST


On Mon, 26 Oct 2026 21:58:13 -0400, Nickolai Zeldovich wrote:
> A task waiting in pin_kill() for another task's ->kill() can take
> p->wait.lock after the pin has been freed, and can return with its
> on-stack wait entry still on p->wait. With BSD process accounting this
> is a use-after-free of the acct structure when umount() of the mount
> holding the accounting file races with acct(2).
>
> pin_kill() takes a still-queued entry as proof that pin_remove() has not
> run, so p is alive. But autoremove_wake_function() dequeues only when
> try_to_wake_up() succeeds: if the waiter was already woken spuriously,
> pin_remove() leaves the entry queued, acct_pin_kill() frees the acct
> with kfree_rcu(), and the grace period can end while the waiter sits
> between schedule() and rcu_read_lock().
>
> [...]

Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] fs_pin: do not trust the pin after a spurious wakeup in pin_kill()
https://git.kernel.org/vfs/vfs/c/f3a6dae67c9c