memory leak in reiserfs_parse_options

From: syzbot
Date: Sun Mar 01 2020 - 14:13:27 EST


Hello,

syzbot found the following crash on:

HEAD commit: 63623fd4 Merge tag 'for-linus' of git://git.kernel.org/pub..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=164d5d29e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=6951e37c8d613538
dashboard link: https://syzkaller.appspot.com/bug?extid=c9e294bbe0333a6b7640
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1308bbede00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15cd8e45e00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+c9e294bbe0333a6b7640@xxxxxxxxxxxxxxxxxxxxxxxxx

executing program
BUG: memory leak
unreferenced object 0xffff88811df75f40 (size 32):
comm "syz-executor611", pid 7103, jiffies 4294943290 (age 13.730s)
hex dump (first 32 bytes):
73 79 7a 00 00 00 00 00 00 00 00 00 00 00 00 00 syz.............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000adefbfe2>] kmemleak_alloc_recursive include/linux/kmemleak.h:43 [inline]
[<00000000adefbfe2>] slab_post_alloc_hook mm/slab.h:586 [inline]
[<00000000adefbfe2>] slab_alloc mm/slab.c:3320 [inline]
[<00000000adefbfe2>] __do_kmalloc mm/slab.c:3654 [inline]
[<00000000adefbfe2>] __kmalloc_track_caller+0x165/0x300 mm/slab.c:3671
[<000000006e7fd3b2>] kstrdup+0x3a/0x70 mm/util.c:60
[<00000000f4f9470a>] reiserfs_parse_options+0x94c/0xe80 fs/reiserfs/super.c:1277
[<0000000080f3e2df>] reiserfs_fill_super+0x1a1/0x10e0 fs/reiserfs/super.c:1941
[<00000000f75361a0>] mount_bdev+0x1ce/0x210 fs/super.c:1417
[<00000000b8c200cc>] get_super_block+0x35/0x40 fs/reiserfs/super.c:2606
[<00000000f4439f43>] legacy_get_tree+0x27/0x80 fs/fs_context.c:622
[<000000008eb8d222>] vfs_get_tree+0x2d/0xe0 fs/super.c:1547
[<00000000367f5f92>] do_new_mount fs/namespace.c:2822 [inline]
[<00000000367f5f92>] do_mount+0x97c/0xc80 fs/namespace.c:3107
[<0000000000ddb42a>] __do_sys_mount fs/namespace.c:3316 [inline]
[<0000000000ddb42a>] __se_sys_mount fs/namespace.c:3293 [inline]
[<0000000000ddb42a>] __x64_sys_mount+0xc0/0x140 fs/namespace.c:3293
[<00000000a60abc01>] do_syscall_64+0x73/0x220 arch/x86/entry/common.c:294
[<000000001bd2aaac>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

BUG: memory leak
unreferenced object 0xffff88811df755c0 (size 32):
comm "syz-executor611", pid 7103, jiffies 4294943290 (age 13.730s)
hex dump (first 32 bytes):
73 79 7a 00 00 00 00 00 00 00 00 00 00 00 00 00 syz.............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000adefbfe2>] kmemleak_alloc_recursive include/linux/kmemleak.h:43 [inline]
[<00000000adefbfe2>] slab_post_alloc_hook mm/slab.h:586 [inline]
[<00000000adefbfe2>] slab_alloc mm/slab.c:3320 [inline]
[<00000000adefbfe2>] __do_kmalloc mm/slab.c:3654 [inline]
[<00000000adefbfe2>] __kmalloc_track_caller+0x165/0x300 mm/slab.c:3671
[<000000006e7fd3b2>] kstrdup+0x3a/0x70 mm/util.c:60
[<00000000f4f9470a>] reiserfs_parse_options+0x94c/0xe80 fs/reiserfs/super.c:1277
[<0000000080f3e2df>] reiserfs_fill_super+0x1a1/0x10e0 fs/reiserfs/super.c:1941
[<00000000f75361a0>] mount_bdev+0x1ce/0x210 fs/super.c:1417
[<00000000b8c200cc>] get_super_block+0x35/0x40 fs/reiserfs/super.c:2606
[<00000000f4439f43>] legacy_get_tree+0x27/0x80 fs/fs_context.c:622
[<000000008eb8d222>] vfs_get_tree+0x2d/0xe0 fs/super.c:1547
[<00000000367f5f92>] do_new_mount fs/namespace.c:2822 [inline]
[<00000000367f5f92>] do_mount+0x97c/0xc80 fs/namespace.c:3107
[<0000000000ddb42a>] __do_sys_mount fs/namespace.c:3316 [inline]
[<0000000000ddb42a>] __se_sys_mount fs/namespace.c:3293 [inline]
[<0000000000ddb42a>] __x64_sys_mount+0xc0/0x140 fs/namespace.c:3293
[<00000000a60abc01>] do_syscall_64+0x73/0x220 arch/x86/entry/common.c:294
[<000000001bd2aaac>] entry_SYSCALL_64_after_hwframe+0x44/0xa9



---
This bug 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 syzkaller@xxxxxxxxxxxxxxxxx

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