linux/ipc
Christian Brauner f0e48172a5
ipc: drop the mqueue mount with kern_unmount() on setup failure
mq_init_ns() creates the mqueue mount with fc_mount_longterm(), so its
->mnt_ns is MNT_NS_INTERNAL. When setting up the mqueue or ipc sysctls
or msg_init_ns() fails afterwards, create_ipc_ns() drops it with a plain
mntput(). With ->mnt_ns set that takes the fast path of
mntput_no_expire(). The count drops to zero and nothing ever kills the
mount, so the mount and the mqueue superblock are leaked.

Commit dc55e35f9e ("ipc: Store mqueue sysctls in the ipc namespace")
added the first failure path after mq_init_ns() and never dropped the
mount. Commit 7229d74e5e ("ipc: create_ipc_ns: drop mqueue mount on
sysctl setup failure") tried to fix that with a mntput() but that
doesn't help for a long-term mount.

Use kern_unmount(). free_ipc() open-codes the same thing for a namespace
that made it.

Fixes: dc55e35f9e ("ipc: Store mqueue sysctls in the ipc namespace")
Fixes: 7229d74e5e ("ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261009-work-fixes-rcu-v1-5-7446d2d335e6@kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-10-14 22:08:03 +02:00
..
compat.c
ipc_sysctl.c ipc: only destroy orphaned shm segments on sysctl write 2026-08-13 15:42:04 -07:00
Makefile
mq_sysctl.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
mqueue.c vfs-7.3-rc1.lookup 2026-08-17 12:03:34 -07:00
msg.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
msgutil.c ns: drop custom reference count initialization for initial namespaces 2025-11-11 10:01:32 +01:00
namespace.c ipc: drop the mqueue mount with kern_unmount() on setup failure 2026-10-14 22:08:03 +02:00
sem.c ipc/sem.c: use unsigned int for nsops 2026-05-27 14:10:25 +02:00
shm.c mm/vma: update do_mmap() to use vma_flags_t 2026-08-06 18:57:01 -07:00
syscall.c
util.c ipc: limit next_id allocation to the valid ID range 2026-05-21 19:06:11 -07:00
util.h sched.h: move pid helpers to pid.h 2023-12-20 19:26:31 -05:00