diff options
| author | Karl Mehltretter <kmehltretter@gmail.com> | 2026-10-09 07:55:46 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-10-22 18:50:19 +0200 |
| commit | c60f9fe1988dd6f96b4b1d4f25fe7474340c7b87 (patch) | |
| tree | 7bb9ac24621fafbf225c6168f7f685357fd20a9c /tools/lib/python | |
| parent | 49184daab01674ca400cbef58ee101dba6dbbb9d (diff) | |
fs: fix ramfs_fs_info leak when rootfs is unmounted
When rootfs is a ramfs, for example with root= on the command line, its
superblock carries a struct ramfs_fs_info from ramfs_init_fs_context().
ramfs_kill_sb() frees it, but rootfs_fs_type uses kill_anon_super().
Before commit 576ee5dfd459 ("fs: add immutable rootfs") rootfs could not
be unmounted. Since then prepare_namespace() pivots into the real root
and unmounts rootfs. When the superblock is destroyed, the structure is
leaked. kmemleak on an SH7785LCR board:
unreferenced object 0x8100a720 (size 32):
comm "swapper/0", pid 0, jiffies 4294892299
backtrace (crc c8bfd23b):
...
ramfs_init_fs_context+0x16/0x48
rootfs_init_fs_context+0x16/0x2c
alloc_fs_context+0x98/0x114
fs_context_for_mount+0x16/0x24
...
Call ramfs_kill_sb() when rootfs is a ramfs. tmpfs frees its own data
in put_super and keeps kill_anon_super().
Fixes: 576ee5dfd459 ("fs: add immutable rootfs")
Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Link: https://patch.msgid.link/20261009055546.85279-1-kmehltretter@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
