[syzbot] [ntfs3?] memory leak in wnd_init

25 views
Skip to first unread message

syzbot

unread,
Sep 11, 2023, 11:43:03 PM9/11/23
to almaz.ale...@paragon-software.com, linux-...@vger.kernel.org, linux-...@vger.kernel.org, nt...@lists.linux.dev, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 4a0fc73da97e Merge tag 's390-6.6-2' of git://git.kernel.or..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=159a5bafa80000
kernel config: https://syzkaller.appspot.com/x/.config?x=52403a23b631cefc
dashboard link: https://syzkaller.appspot.com/bug?extid=9ccdd15480e9d9833822
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1428f558680000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=159c2494680000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/7e7536435862/disk-4a0fc73d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f5b10d577113/vmlinux-4a0fc73d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/430b464e2d50/bzImage-4a0fc73d.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/25cbc30b9bc2/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9ccdd1...@syzkaller.appspotmail.com

BUG: memory leak
unreferenced object 0xffff8881092d8120 (size 8):
comm "syz-executor271", pid 5017, jiffies 4294942948 (age 12.860s)
hex dump (first 8 bytes):
65 00 00 00 00 00 00 00 e.......
backtrace:
[<ffffffff8157443b>] __do_kmalloc_node mm/slab_common.c:1022 [inline]
[<ffffffff8157443b>] __kmalloc+0x4b/0x150 mm/slab_common.c:1036
[<ffffffff81bc99ac>] kmalloc_array include/linux/slab.h:636 [inline]
[<ffffffff81bc99ac>] kcalloc include/linux/slab.h:667 [inline]
[<ffffffff81bc99ac>] wnd_init+0xdc/0x140 fs/ntfs3/bitmap.c:662
[<ffffffff81c023dd>] ntfs_fill_super+0x116d/0x22f0 fs/ntfs3/super.c:1257
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88810bf880c0 (size 64):
comm "syz-executor271", pid 5017, jiffies 4294942948 (age 12.860s)
hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 81 f8 0b 81 88 ff ff ................
00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff81bc7ddc>] wnd_add_free_ext+0x6c/0x860 fs/ntfs3/bitmap.c:337
[<ffffffff81bc9640>] wnd_rescan+0x370/0x600 fs/ntfs3/bitmap.c:597
[<ffffffff81bc99c2>] wnd_init+0xf2/0x140 fs/ntfs3/bitmap.c:666
[<ffffffff81c023dd>] ntfs_fill_super+0x116d/0x22f0 fs/ntfs3/super.c:1257
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88810bf88100 (size 64):
comm "syz-executor271", pid 5017, jiffies 4294942948 (age 12.860s)
hex dump (first 32 bytes):
c0 80 f8 0b 81 88 ff ff 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 21 00 00 00 00 00 00 00 ........!.......
backtrace:
[<ffffffff81bc7ddc>] wnd_add_free_ext+0x6c/0x860 fs/ntfs3/bitmap.c:337
[<ffffffff81bc9775>] wnd_rescan+0x4a5/0x600 fs/ntfs3/bitmap.c:621
[<ffffffff81bc99c2>] wnd_init+0xf2/0x140 fs/ntfs3/bitmap.c:666
[<ffffffff81c023dd>] ntfs_fill_super+0x116d/0x22f0 fs/ntfs3/super.c:1257
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88810a1d8b40 (size 64):
comm "syz-executor271", pid 5017, jiffies 4294942948 (age 12.860s)
hex dump (first 32 bytes):
00 00 00 00 01 00 00 00 47 00 00 00 00 00 00 00 ........G.......
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff815742ee>] __do_kmalloc_node mm/slab_common.c:1022 [inline]
[<ffffffff815742ee>] __kmalloc_node+0x4e/0x150 mm/slab_common.c:1030
[<ffffffff81563919>] kmalloc_node include/linux/slab.h:619 [inline]
[<ffffffff81563919>] kvmalloc_node+0x99/0x170 mm/util.c:607
[<ffffffff81bfd949>] kvmalloc include/linux/slab.h:737 [inline]
[<ffffffff81bfd949>] run_add_entry+0x559/0x720 fs/ntfs3/run.c:389
[<ffffffff81bfee3c>] run_unpack+0x53c/0x620 fs/ntfs3/run.c:1021
[<ffffffff81bfef97>] run_unpack_ex+0x77/0x320 fs/ntfs3/run.c:1060
[<ffffffff81bee9d3>] ntfs_read_mft fs/ntfs3/inode.c:400 [inline]
[<ffffffff81bee9d3>] ntfs_iget5+0x633/0x1a90 fs/ntfs3/inode.c:532
[<ffffffff81c0245d>] ntfs_fill_super+0x11ed/0x22f0 fs/ntfs3/super.c:1272
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff8881092d8468 (size 8):
comm "syz-executor271", pid 5017, jiffies 4294942948 (age 12.860s)
hex dump (first 8 bytes):
0f 01 00 00 00 00 00 00 ........
backtrace:
[<ffffffff8157443b>] __do_kmalloc_node mm/slab_common.c:1022 [inline]
[<ffffffff8157443b>] __kmalloc+0x4b/0x150 mm/slab_common.c:1036
[<ffffffff81bc99ac>] kmalloc_array include/linux/slab.h:636 [inline]
[<ffffffff81bc99ac>] kcalloc include/linux/slab.h:667 [inline]
[<ffffffff81bc99ac>] wnd_init+0xdc/0x140 fs/ntfs3/bitmap.c:662
[<ffffffff81c02509>] ntfs_fill_super+0x1299/0x22f0 fs/ntfs3/super.c:1294
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] 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 syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

Edward AD

unread,
Sep 12, 2023, 9:07:40 PM9/12/23
to syzbot+9ccdd1...@syzkaller.appspotmail.com, syzkall...@googlegroups.com
please test nfs3

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

diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c
index 107e808e06ea..7a5d85f812da 100644
--- a/fs/ntfs3/bitmap.c
+++ b/fs/ntfs3/bitmap.c
@@ -664,8 +664,11 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits)
return -ENOMEM;

err = wnd_rescan(wnd);
- if (err)
+ if (err) {
+ kfree(wnd->free_bits);
+ wnd->free_bits = NULL;
return err;
+ }

wnd->inited = true;

syzbot

unread,
Sep 12, 2023, 9:26:28 PM9/12/23
to ead...@sina.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
memory leak in run_add_entry

BUG: memory leak
unreferenced object 0xffff88811b10ba00 (size 64):
comm "syz-executor.0", pid 5511, jiffies 4294944349 (age 13.790s)
hex dump (first 32 bytes):
00 00 00 00 01 00 00 00 02 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff815742ee>] __do_kmalloc_node mm/slab_common.c:1022 [inline]
[<ffffffff815742ee>] __kmalloc_node+0x4e/0x150 mm/slab_common.c:1030
[<ffffffff81563919>] kmalloc_node include/linux/slab.h:619 [inline]
[<ffffffff81563919>] kvmalloc_node+0x99/0x170 mm/util.c:607
[<ffffffff81bfd969>] kvmalloc include/linux/slab.h:737 [inline]
[<ffffffff81bfd969>] run_add_entry+0x559/0x720 fs/ntfs3/run.c:389
[<ffffffff81bfee5c>] run_unpack+0x53c/0x620 fs/ntfs3/run.c:1021
[<ffffffff81bfefb7>] run_unpack_ex+0x77/0x320 fs/ntfs3/run.c:1060
[<ffffffff81bee9f3>] ntfs_read_mft fs/ntfs3/inode.c:400 [inline]
[<ffffffff81bee9f3>] ntfs_iget5+0x633/0x1a90 fs/ntfs3/inode.c:532
[<ffffffff81bd0f06>] ntfs_loadlog_and_replay+0x86/0x280 fs/ntfs3/fsntfs.c:297
[<ffffffff81c022e7>] ntfs_fill_super+0x1057/0x22f0 fs/ntfs3/super.c:1222
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88811b6960d0 (size 8):
comm "syz-executor.0", pid 5511, jiffies 4294944349 (age 13.790s)
hex dump (first 8 bytes):
65 00 00 00 00 00 00 00 e.......
backtrace:
[<ffffffff8157443b>] __do_kmalloc_node mm/slab_common.c:1022 [inline]
[<ffffffff8157443b>] __kmalloc+0x4b/0x150 mm/slab_common.c:1036
[<ffffffff81bc99ac>] kmalloc_array include/linux/slab.h:636 [inline]
[<ffffffff81bc99ac>] kcalloc include/linux/slab.h:667 [inline]
[<ffffffff81bc99ac>] wnd_init+0xdc/0x160 fs/ntfs3/bitmap.c:662
[<ffffffff81c023fd>] ntfs_fill_super+0x116d/0x22f0 fs/ntfs3/super.c:1257
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88810fc380c0 (size 64):
comm "syz-executor.0", pid 5511, jiffies 4294944349 (age 13.790s)
hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 81 c3 0f 81 88 ff ff ................
00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff81bc7ddc>] wnd_add_free_ext+0x6c/0x860 fs/ntfs3/bitmap.c:337
[<ffffffff81bc9640>] wnd_rescan+0x370/0x600 fs/ntfs3/bitmap.c:597
[<ffffffff81bc99c2>] wnd_init+0xf2/0x160 fs/ntfs3/bitmap.c:666
[<ffffffff81c023fd>] ntfs_fill_super+0x116d/0x22f0 fs/ntfs3/super.c:1257
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88810fc38100 (size 64):
comm "syz-executor.0", pid 5511, jiffies 4294944349 (age 13.790s)
hex dump (first 32 bytes):
c0 80 c3 0f 81 88 ff ff 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 21 00 00 00 00 00 00 00 ........!.......
backtrace:
[<ffffffff81bc7ddc>] wnd_add_free_ext+0x6c/0x860 fs/ntfs3/bitmap.c:337
[<ffffffff81bc9775>] wnd_rescan+0x4a5/0x600 fs/ntfs3/bitmap.c:621
[<ffffffff81bc99c2>] wnd_init+0xf2/0x160 fs/ntfs3/bitmap.c:666
[<ffffffff81c023fd>] ntfs_fill_super+0x116d/0x22f0 fs/ntfs3/super.c:1257
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd



Tested on:

commit: 4a0fc73d Merge tag 's390-6.6-2' of git://git.kernel.or..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1334892c680000
kernel config: https://syzkaller.appspot.com/x/.config?x=52403a23b631cefc
dashboard link: https://syzkaller.appspot.com/bug?extid=9ccdd15480e9d9833822
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=11f32f78680000

Edward AD

unread,
Sep 13, 2023, 7:11:24 AM9/13/23
to syzbot+9ccdd1...@syzkaller.appspotmail.com, syzkall...@googlegroups.com
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 5fffddea554f..882a36621fbf 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -1556,6 +1556,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
return 0;

put_inode_out:
+ wnd_close(&sbi->mft.bitmap);
iput(inode);
out:
kfree(boot2);

syzbot

unread,
Sep 13, 2023, 8:39:30 AM9/13/23
to ead...@sina.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
memory leak in run_add_entry

BUG: memory leak
unreferenced object 0xffff888119c49500 (size 64):
comm "syz-executor.0", pid 5497, jiffies 4294944230 (age 13.030s)
hex dump (first 32 bytes):
00 00 00 00 01 00 00 00 02 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff815742ee>] __do_kmalloc_node mm/slab_common.c:1022 [inline]
[<ffffffff815742ee>] __kmalloc_node+0x4e/0x150 mm/slab_common.c:1030
[<ffffffff81563919>] kmalloc_node include/linux/slab.h:619 [inline]
[<ffffffff81563919>] kvmalloc_node+0x99/0x170 mm/util.c:607
[<ffffffff81bfd969>] kvmalloc include/linux/slab.h:737 [inline]
[<ffffffff81bfd969>] run_add_entry+0x559/0x720 fs/ntfs3/run.c:389
[<ffffffff81bfee5c>] run_unpack+0x53c/0x620 fs/ntfs3/run.c:1021
[<ffffffff81bfefb7>] run_unpack_ex+0x77/0x320 fs/ntfs3/run.c:1060
[<ffffffff81bee9f3>] ntfs_read_mft fs/ntfs3/inode.c:400 [inline]
[<ffffffff81bee9f3>] ntfs_iget5+0x633/0x1a90 fs/ntfs3/inode.c:532
[<ffffffff81bd0f06>] ntfs_loadlog_and_replay+0x86/0x280 fs/ntfs3/fsntfs.c:297
[<ffffffff81c022e3>] ntfs_fill_super+0x1053/0x2330 fs/ntfs3/super.c:1222
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88811bbc4098 (size 8):
comm "syz-executor.0", pid 5497, jiffies 4294944230 (age 13.030s)
hex dump (first 8 bytes):
65 00 00 00 00 00 00 00 e.......
backtrace:
[<ffffffff8157443b>] __do_kmalloc_node mm/slab_common.c:1022 [inline]
[<ffffffff8157443b>] __kmalloc+0x4b/0x150 mm/slab_common.c:1036
[<ffffffff81bc99ac>] kmalloc_array include/linux/slab.h:636 [inline]
[<ffffffff81bc99ac>] kcalloc include/linux/slab.h:667 [inline]
[<ffffffff81bc99ac>] wnd_init+0xdc/0x160 fs/ntfs3/bitmap.c:662
[<ffffffff81c02400>] ntfs_fill_super+0x1170/0x2330 fs/ntfs3/super.c:1257
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88810d2aa040 (size 64):
comm "syz-executor.0", pid 5497, jiffies 4294944230 (age 13.030s)
hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 80 a0 2a 0d 81 88 ff ff ..........*.....
00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff81bc7ddc>] wnd_add_free_ext+0x6c/0x860 fs/ntfs3/bitmap.c:337
[<ffffffff81bc9640>] wnd_rescan+0x370/0x600 fs/ntfs3/bitmap.c:597
[<ffffffff81bc99c2>] wnd_init+0xf2/0x160 fs/ntfs3/bitmap.c:666
[<ffffffff81c02400>] ntfs_fill_super+0x1170/0x2330 fs/ntfs3/super.c:1257
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88810d2aa080 (size 64):
comm "syz-executor.0", pid 5497, jiffies 4294944230 (age 13.030s)
hex dump (first 32 bytes):
40 a0 2a 0d 81 88 ff ff 00 00 00 00 00 00 00 00 @.*.............
00 00 00 00 00 00 00 00 21 00 00 00 00 00 00 00 ........!.......
backtrace:
[<ffffffff81bc7ddc>] wnd_add_free_ext+0x6c/0x860 fs/ntfs3/bitmap.c:337
[<ffffffff81bc9775>] wnd_rescan+0x4a5/0x600 fs/ntfs3/bitmap.c:621
[<ffffffff81bc99c2>] wnd_init+0xf2/0x160 fs/ntfs3/bitmap.c:666
[<ffffffff81c02400>] ntfs_fill_super+0x1170/0x2330 fs/ntfs3/super.c:1257
[<ffffffff81691a21>] get_tree_bdev+0x1b1/0x280 fs/super.c:1577
[<ffffffff8168ecda>] vfs_get_tree+0x2a/0x130 fs/super.c:1750
[<ffffffff816d44ef>] do_new_mount fs/namespace.c:3335 [inline]
[<ffffffff816d44ef>] path_mount+0xc8f/0x10d0 fs/namespace.c:3662
[<ffffffff816d50e1>] do_mount fs/namespace.c:3675 [inline]
[<ffffffff816d50e1>] __do_sys_mount fs/namespace.c:3884 [inline]
[<ffffffff816d50e1>] __se_sys_mount fs/namespace.c:3861 [inline]
[<ffffffff816d50e1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3861
[<ffffffff84b2dfa8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84b2dfa8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd



Tested on:

commit: 4a0fc73d Merge tag 's390-6.6-2' of git://git.kernel.or..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=115f1378680000
kernel config: https://syzkaller.appspot.com/x/.config?x=52403a23b631cefc
dashboard link: https://syzkaller.appspot.com/bug?extid=9ccdd15480e9d9833822
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1582dfec680000

Shigeru Yoshida

unread,
Sep 16, 2023, 1:12:54 PM9/16/23
to syzbot, syzkall...@googlegroups.com
#syz test

diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index cfec5e0c7f66..a9610f5f4cc0 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -1563,6 +1563,13 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
iput(inode);
out:
kfree(boot2);
+
+ if (sbi->mft.bitmap.inited)
+ wnd_close(&sbi->mft.bitmap);
+
+ if (sbi->used.bitmap.inited)
+ wnd_close(&sbi->used.bitmap);
+
return err;
}


syzbot

unread,
Sep 16, 2023, 1:41:31 PM9/16/23
to syos...@redhat.com, syzkall...@googlegroups.com
Hello,

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

Reported-and-tested-by: syzbot+9ccdd1...@syzkaller.appspotmail.com

Tested on:

commit: 57d88e8a Merge tag 'linux-kselftest-fixes-6.6-rc2' of ..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16b1b154680000
kernel config: https://syzkaller.appspot.com/x/.config?x=1a8cb04f1ef73d4a
dashboard link: https://syzkaller.appspot.com/bug?extid=9ccdd15480e9d9833822
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=10177e54680000

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

syzbot

unread,
Jan 3, 2024, 11:01:16 AM1/3/24
to syzkall...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages