linux/fs/adfs
Ahmet Eray Karadag b12e20c6ac
adfs: fix memory leak in sb->s_fs_info
Syzbot reported a memory leak in adfs during the mount process. The issue
arises because the ownership of the allocated (struct adfs_sb_info) is
transferred from the filesystem context to the superblock via sget_fc().
This function sets fc->s_fs_info to NULL after the transfer.

The ADFS filesystem previously used the default kill_block_super for
superblock destruction. This helper performs generic cleanup but does not
free the private sb->s_fs_info data. Since fc->s_fs_info is set to
NULL during the transfer, the standard context cleanup (adfs_free_fc)
also skips freeing this memory. As a result, if the superblock is
destroyed, the allocated struct adfs_sb_info is leaked.

Fix this by implementing a custom .kill_sb callback (adfs_kill_sb)
that explicitly frees sb->s_fs_info before invoking the generic
kill_block_super.

Reported-by: syzbot+1c70732df5fd4f0e4fbb@syzkaller.appspotmail.com
Signed-off-by: Ahmet Eray Karadag <eraykrdg1@gmail.com>
Link: https://patch.msgid.link/20251215031433.182205-2-eraykrdg1@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-31 09:36:20 +02:00
..
adfs.h adfs: rename adfs_notify_change to adfs_setattr 2026-03-26 15:16:54 +01:00
dir_f.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
dir_f.h adfs: delete unused "union adfs_dirtail" definition 2023-08-21 13:46:23 -07:00
dir_fplus.c fs/adfs: bigdir: Fix an error code in adfs_fplus_read() 2020-01-25 11:31:59 -05:00
dir_fplus.h fs/adfs: dir: modernise on-disk directory structures 2020-01-20 20:12:41 -05:00
dir.c vfs-7.1-rc1.misc 2026-04-13 14:20:11 -07:00
file.c vfs-7.1-rc1.misc 2026-04-13 14:20:11 -07:00
inode.c adfs: rename adfs_notify_change to adfs_setattr 2026-03-26 15:16:54 +01:00
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
map.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
super.c adfs: fix memory leak in sb->s_fs_info 2026-08-31 09:36:20 +02:00