2022-08-23 06:56:00

by syzbot

[permalink] [raw]
Subject: [syzbot] memory leak in ntfs_init_fs_context

Hello,

syzbot found the following issue on:

HEAD commit: 1c23f9e627a7 Linux 6.0-rc2
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16caa92d080000
kernel config: https://syzkaller.appspot.com/x/.config?x=b1831d905b683446
dashboard link: https://syzkaller.appspot.com/bug?extid=9d67170b20e8f94351c8
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=161472f3080000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=145f3e2d080000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

executing program
executing program
BUG: memory leak
unreferenced object 0xffff8881100918a0 (size 32):
comm "syz-executor151", pid 3611, jiffies 4294944949 (age 8.110s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 c0 ff c0 ff 00 00 00 00 ................
backtrace:
[<ffffffff81b23cb2>] kmalloc include/linux/slab.h:600 [inline]
[<ffffffff81b23cb2>] kzalloc include/linux/slab.h:733 [inline]
[<ffffffff81b23cb2>] ntfs_init_fs_context+0x22/0x1e0 fs/ntfs3/super.c:1397
[<ffffffff81650025>] alloc_fs_context+0x225/0x3b0 fs/fs_context.c:290
[<ffffffff8162beb3>] do_new_mount fs/namespace.c:3025 [inline]
[<ffffffff8162beb3>] path_mount+0x6f3/0x10d0 fs/namespace.c:3370
[<ffffffff8162cfde>] do_mount fs/namespace.c:3383 [inline]
[<ffffffff8162cfde>] __do_sys_mount fs/namespace.c:3591 [inline]
[<ffffffff8162cfde>] __se_sys_mount fs/namespace.c:3568 [inline]
[<ffffffff8162cfde>] __x64_sys_mount+0x18e/0x1d0 fs/namespace.c:3568
[<ffffffff845e4855>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff845e4855>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
[<ffffffff84800087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd



---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at [email protected].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches


2022-08-24 16:43:29

by Siddh Raman Pant

[permalink] [raw]
Subject: Re: [syzbot] memory leak in ntfs_init_fs_context

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

---
fs/ntfs3/super.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 47012c9bf505..c0e45f170701 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -1281,6 +1281,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
* Free resources here.
* ntfs_fs_free will be called with fc->s_fs_info = NULL
*/
+ put_mount_options(sbi->options);
put_ntfs(sbi);
sb->s_fs_info = NULL;

--
2.35.1


2022-08-24 17:49:53

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] memory leak in ntfs_init_fs_context

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: [email protected]

Tested on:

commit: c40e8341 Merge tag 'cgroup-for-6.0-rc2-fixes' of git:/..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=11e16ca3080000
kernel config: https://syzkaller.appspot.com/x/.config?x=b1831d905b683446
dashboard link: https://syzkaller.appspot.com/bug?extid=9d67170b20e8f94351c8
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=1503a42b080000

Note: testing is done by a robot and is best-effort only.