================================================================== BUG: KASAN: use-after-free in btrfs_printk+0x38b/0x40c fs/btrfs/super.c:246 Read of size 8 at addr ffff88804d7a06a0 by task syz-executor.5/27227 CPU: 1 PID: 27227 Comm: syz-executor.5 Not tainted 5.9.0-rc5-next-20200921-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x198/0x1fb lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:385 __kasan_report mm/kasan/report.c:545 [inline] kasan_report.cold+0x1f/0x37 mm/kasan/report.c:562 btrfs_printk+0x38b/0x40c fs/btrfs/super.c:246 device_list_add.cold+0x99/0x31e fs/btrfs/volumes.c:943 btrfs_scan_one_device+0x339/0x4a0 fs/btrfs/volumes.c:1360 btrfs_mount_root+0x4d5/0xbb0 fs/btrfs/super.c:1633 legacy_get_tree+0x105/0x220 fs/fs_context.c:592 vfs_get_tree+0x89/0x2f0 fs/super.c:1547 fc_mount fs/namespace.c:983 [inline] vfs_kern_mount.part.0+0xd3/0x170 fs/namespace.c:1013 vfs_kern_mount+0x3c/0x60 fs/namespace.c:1000 btrfs_mount+0x234/0xa60 fs/btrfs/super.c:1731 legacy_get_tree+0x105/0x220 fs/fs_context.c:592 vfs_get_tree+0x89/0x2f0 fs/super.c:1547 do_new_mount fs/namespace.c:2896 [inline] path_mount+0x12ae/0x1e70 fs/namespace.c:3227 do_mount fs/namespace.c:3240 [inline] __do_sys_mount fs/namespace.c:3448 [inline] __se_sys_mount fs/namespace.c:3425 [inline] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3425 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x46004a Code: b8 a6 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 fd 89 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 da 89 fb ff c3 66 0f 1f 84 00 00 00 00 00 RSP: 002b:00007fc41937aa88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fc41937ab20 RCX: 000000000046004a RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007fc41937aae0 RBP: 00007fc41937aae0 R08: 00007fc41937ab20 R09: 0000000020000000 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000000 R13: 0000000020000100 R14: 0000000020000200 R15: 0000000020014900 Allocated by task 27179: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461 kmalloc_node include/linux/slab.h:577 [inline] kvmalloc_node+0xb4/0xf0 mm/util.c:575 kvmalloc include/linux/mm.h:765 [inline] kvzalloc include/linux/mm.h:773 [inline] btrfs_mount_root+0x117/0xbb0 fs/btrfs/super.c:1612 legacy_get_tree+0x105/0x220 fs/fs_context.c:592 vfs_get_tree+0x89/0x2f0 fs/super.c:1547 fc_mount fs/namespace.c:983 [inline] vfs_kern_mount.part.0+0xd3/0x170 fs/namespace.c:1013 vfs_kern_mount+0x3c/0x60 fs/namespace.c:1000 btrfs_mount+0x234/0xa60 fs/btrfs/super.c:1731 legacy_get_tree+0x105/0x220 fs/fs_context.c:592 vfs_get_tree+0x89/0x2f0 fs/super.c:1547 do_new_mount fs/namespace.c:2896 [inline] path_mount+0x12ae/0x1e70 fs/namespace.c:3227 do_mount fs/namespace.c:3240 [inline] __do_sys_mount fs/namespace.c:3448 [inline] __se_sys_mount fs/namespace.c:3425 [inline] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3425 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 27179: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355 __kasan_slab_free+0xd8/0x120 mm/kasan/common.c:422 __cache_free mm/slab.c:3416 [inline] kfree+0x10e/0x2a0 mm/slab.c:3754 kvfree+0x42/0x50 mm/util.c:604 deactivate_locked_super+0x94/0x160 fs/super.c:335 btrfs_mount_root+0x772/0xbb0 fs/btrfs/super.c:1677 legacy_get_tree+0x105/0x220 fs/fs_context.c:592 vfs_get_tree+0x89/0x2f0 fs/super.c:1547 fc_mount fs/namespace.c:983 [inline] vfs_kern_mount.part.0+0xd3/0x170 fs/namespace.c:1013 vfs_kern_mount+0x3c/0x60 fs/namespace.c:1000 btrfs_mount+0x234/0xa60 fs/btrfs/super.c:1731 legacy_get_tree+0x105/0x220 fs/fs_context.c:592 vfs_get_tree+0x89/0x2f0 fs/super.c:1547 do_new_mount fs/namespace.c:2896 [inline] path_mount+0x12ae/0x1e70 fs/namespace.c:3227 do_mount fs/namespace.c:3240 [inline] __do_sys_mount fs/namespace.c:3448 [inline] __se_sys_mount fs/namespace.c:3425 [inline] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3425 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Last call_rcu(): kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_record_aux_stack+0x82/0xb0 mm/kasan/generic.c:346 __call_rcu kernel/rcu/tree.c:2959 [inline] call_rcu+0x15e/0x7d0 kernel/rcu/tree.c:3033 ring_buffer_put kernel/events/core.c:5868 [inline] ring_buffer_put+0xa1/0xe0 kernel/events/core.c:5861 perf_mmap_close+0x2ec/0xe20 kernel/events/core.c:6002 remove_vma+0xa9/0x170 mm/mmap.c:180 exit_mmap+0x351/0x530 mm/mmap.c:3243 __mmput+0x122/0x470 kernel/fork.c:1076 mmput+0x53/0x60 kernel/fork.c:1097 exit_mm kernel/exit.c:483 [inline] do_exit+0xa31/0x2930 kernel/exit.c:793 do_group_exit+0x125/0x310 kernel/exit.c:903 __do_sys_exit_group kernel/exit.c:914 [inline] __se_sys_exit_group kernel/exit.c:912 [inline] __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:912 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff88804d7a0000 which belongs to the cache kmalloc-16k of size 16384 The buggy address is located 1696 bytes inside of 16384-byte region [ffff88804d7a0000, ffff88804d7a4000) The buggy address belongs to the page: page:00000000746c6c1f refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4d7a0 head:00000000746c6c1f order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfffe0000010200(slab|head) raw: 00fffe0000010200 ffffea00012d2808 ffffea000141d808 ffff8880aa040b00 raw: 0000000000000000 ffff88804d7a0000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88804d7a0580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804d7a0600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88804d7a0680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804d7a0700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804d7a0780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================