Re: [PATCH v1] ucount: read the parent ucounts before dropping the rlimit count

From: Christian Brauner

Date: Fri Oct 30 2026 - 11:03:43 EST


On Fri, 23 Oct 2026 21:55:13 -0400, Nickolai Zeldovich wrote:
> do_dec_rlimit_put_ucounts() drops its share of iter->rlimit[type] and
> only then loads iter->ns->ucounts. If the decrement leaves the count
> non-zero, a concurrent caller can take it to zero and put the last
> reference, which frees the ucounts and possibly its user namespace with
> kfree_rcu(). An exiting task frees its pending signals without siglock
> or any RCU read-side section, so when it is preempted between the
> decrement and the load for a grace period it reads freed memory and
> then decrements a counter through the pointer it found there.
>
> [...]

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] ucount: read the parent ucounts before dropping the rlimit count
https://git.kernel.org/vfs/vfs/c/38bf603d1ea5