futex: Move futex cleanup to __mmdrop()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 30 Jul 2025 19:44:55 +0000 (21:44 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 2 Aug 2025 13:11:52 +0000 (15:11 +0200)
commite703b7e247503b8bf87b62c02a4392749b09eca8
treece803d8a07303fbb4d6685607c8929f1ae34e514
parent98e8f2c0e0930feee6a2538450c74d9d7de0a9cc
futex: Move futex cleanup to __mmdrop()

Futex hash allocations are done in mm_init() and the cleanup happens in
__mmput(). That works most of the time, but there are mm instances which
are instantiated via mm_alloc() and freed via mmdrop(), which causes the
futex hash to be leaked.

Move the cleanup to __mmdrop().

Fixes: 56180dd20c19 ("futex: Use RCU-based per-CPU reference counting instead of rcuref_t")
Reported-by: André Draszik <andre.draszik@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: André Draszik <andre.draszik@linaro.org>
Link: https://lore.kernel.org/all/87ldo5ihu0.ffs@tglx
Closes: https://lore.kernel.org/all/0c8cc83bb73abf080faf584f319008b67d0931db.camel@linaro.org
kernel/fork.c