==================================================================
BUG: KASAN: slab-use-after-free in sync_blockdev_nowait+0x3a/0x60
Read of size 8 at addr ffff888029bf4538 by task syz-executor/5852

CPU: 0 UID: 0 PID: 5852 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250
 print_report+0xca/0x240
 kasan_report+0x118/0x150
 sync_blockdev_nowait+0x3a/0x60
 sync_filesystem+0x149/0x230
 generic_shutdown_super+0x6f/0x2c0
 bch2_kill_sb+0x41/0x50
 deactivate_locked_super+0xbc/0x130
 cleanup_mnt+0x425/0x4c0
 task_work_run+0x1d4/0x260
 exit_to_user_mode_loop+0xec/0x110
 do_syscall_64+0x2bd/0x3b0
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fcb1c18ff17
Code: a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 a8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffc62f5ecf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 00007fcb1c211c05 RCX: 00007fcb1c18ff17
RDX: 0000000000000000 RSI: 0000000000000009 RDI: 00007ffc62f5edb0
RBP: 00007ffc62f5edb0 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffc62f5fe40
R13: 00007fcb1c211c05 R14: 00000000000147c4 R15: 00007ffc62f5fe80
 </TASK>

Allocated by task 7212:
 kasan_save_track+0x3e/0x80
 __kasan_slab_alloc+0x6c/0x80
 kmem_cache_alloc_lru_noprof+0x1c6/0x3d0
 bdev_alloc_inode+0x29/0x90
 alloc_inode+0x6a/0x1b0
 new_inode+0x22/0x170
 bdev_alloc+0x26/0x380
 __alloc_disk_node+0x11c/0x550
 __blk_mq_alloc_disk+0x196/0x340
 loop_add+0x411/0xad0
 loop_control_ioctl+0x128/0x5a0
 __se_sys_ioctl+0xfc/0x170
 do_syscall_64+0xfa/0x3b0
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 15:
 kasan_save_track+0x3e/0x80
 kasan_save_free_info+0x46/0x50
 __kasan_slab_free+0x5b/0x80
 kmem_cache_free+0x18f/0x400
 rcu_core+0xcab/0x1770
 handle_softirqs+0x286/0x870
 run_ksoftirqd+0x9b/0x100
 smpboot_thread_fn+0x542/0xa60
 kthread+0x711/0x8a0
 ret_from_fork+0x3fc/0x770
 ret_from_fork_asm+0x1a/0x30

Last potentially related work creation:
 kasan_save_stack+0x3e/0x60
 kasan_record_aux_stack+0xbd/0xd0
 call_rcu+0x157/0x9c0
 evict+0x847/0x9c0
 device_release+0x9c/0x1c0
 kobject_put+0x22b/0x480
 loop_control_ioctl+0x4ac/0x5a0
 __se_sys_ioctl+0xfc/0x170
 do_syscall_64+0xfa/0x3b0
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff888029bf4500
 which belongs to the cache bdev_cache of size 2792
The buggy address is located 56 bytes inside of
 freed 2792-byte region [ffff888029bf4500, ffff888029bf4fe8)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888029bf1700 pfn:0x29bf0
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff8880214ef601
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801bee4280 dead000000000122 0000000000000000
raw: ffff888029bf1700 00000000800b0009 00000000f5000000 ffff8880214ef601
head: 00fff00000000040 ffff88801bee4280 dead000000000122 0000000000000000
head: ffff888029bf1700 00000000800b0009 00000000f5000000 ffff8880214ef601
head: 00fff00000000003 ffffea0000a6fc01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd20d0(__GFP_RECLAIMABLE|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6685, tgid 6685 (udevd), ts 75909827839, free_ts 61327569764
 post_alloc_hook+0x240/0x2a0
 get_page_from_freelist+0x21e4/0x22c0
 __alloc_frozen_pages_noprof+0x181/0x370
 alloc_pages_mpol+0x232/0x4a0
 allocate_slab+0x8a/0x370
 ___slab_alloc+0xbeb/0x1410
 kmem_cache_alloc_lru_noprof+0x288/0x3d0
 bdev_alloc_inode+0x29/0x90
 alloc_inode+0x6a/0x1b0
 new_inode+0x22/0x170
 bdev_alloc+0x26/0x380
 add_partition+0x1c3/0x8e0
 bdev_disk_changed+0xb50/0x14b0
 blkdev_get_whole+0x380/0x510
 bdev_open+0x31e/0xd30
 blkdev_open+0x3a8/0x510
page last free pid 5850 tgid 5850 stack trace:
 __free_frozen_pages+0xbc4/0xd30
 __slab_free+0x303/0x3c0
 qlist_free_all+0x97/0x140
 kasan_quarantine_reduce+0x148/0x160
 __kasan_slab_alloc+0x22/0x80
 __kmalloc_noprof+0x224/0x4f0
 tomoyo_encode+0x28b/0x550
 tomoyo_path_perm+0x2b3/0x4b0
 tomoyo_path_symlink+0xa3/0xe0
 security_path_symlink+0x177/0x380
 do_symlinkat+0x107/0x3f0
 __x64_sys_symlink+0x7a/0x90
 do_syscall_64+0xfa/0x3b0
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffff888029bf4400: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc
 ffff888029bf4480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888029bf4500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff888029bf4580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888029bf4600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
