==================================================================
BUG: KASAN: use-after-free in wb_put_many include/linux/backing-dev-defs.h:250 [inline]
BUG: KASAN: use-after-free in wb_put include/linux/backing-dev-defs.h:268 [inline]
BUG: KASAN: use-after-free in inode_detach_wb include/linux/writeback.h:251 [inline]
BUG: KASAN: use-after-free in bdev_evict_inode+0x3c3/0x410 fs/block_dev.c:834
Read of size 8 at addr ffff888146534060 by task syz-executor.0/16232

CPU: 1 PID: 16232 Comm: syz-executor.0 Not tainted 5.14.0-rc5-next-20210816-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:256
 __kasan_report mm/kasan/report.c:442 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
 wb_put_many include/linux/backing-dev-defs.h:250 [inline]
 wb_put include/linux/backing-dev-defs.h:268 [inline]
 inode_detach_wb include/linux/writeback.h:251 [inline]
 bdev_evict_inode+0x3c3/0x410 fs/block_dev.c:834
 evict+0x2ed/0x6b0 fs/inode.c:590
 iput_final fs/inode.c:1670 [inline]
 iput.part.0+0x539/0x850 fs/inode.c:1696
 iput+0x58/0x70 fs/inode.c:1686
 device_release+0x9f/0x240 drivers/base/core.c:2195
 kobject_cleanup lib/kobject.c:705 [inline]
 kobject_release lib/kobject.c:736 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x1c8/0x540 lib/kobject.c:753
 put_device+0x1b/0x30 drivers/base/core.c:3466
 put_disk block/genhd.c:1336 [inline]
 blk_cleanup_disk+0x6b/0x80 block/genhd.c:1352
 loop_remove drivers/block/loop.c:2415 [inline]
 loop_control_remove drivers/block/loop.c:2463 [inline]
 loop_control_ioctl+0x3db/0x450 drivers/block/loop.c:2495
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x4665e9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f381487c188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9
RDX: 0000000000000000 RSI: 0000000000004c81 RDI: 0000000000000003
RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80
R13: 00007ffec4c45aef R14: 00007f381487c300 R15: 0000000000022000

Allocated by task 1:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 ____kasan_kmalloc mm/kasan/common.c:472 [inline]
 __kasan_kmalloc+0x9b/0xd0 mm/kasan/common.c:522
 kmalloc_node include/linux/slab.h:609 [inline]
 kzalloc_node include/linux/slab.h:732 [inline]
 bdi_alloc+0x43/0x180 mm/backing-dev.c:810
 __alloc_disk_node+0x6e/0x500 block/genhd.c:1268
 __blk_mq_alloc_disk+0xec/0x190 block/blk-mq.c:3147
 loop_add+0x324/0x940 drivers/block/loop.c:2344
 loop_init+0x1f4/0x216 drivers/block/loop.c:2575
 do_one_initcall+0x103/0x650 init/main.c:1292
 do_initcall_level init/main.c:1367 [inline]
 do_initcalls init/main.c:1383 [inline]
 do_basic_setup init/main.c:1402 [inline]
 kernel_init_freeable+0x6b1/0x73a init/main.c:1604
 kernel_init+0x1a/0x1d0 init/main.c:1496
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Freed by task 16232:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360
 ____kasan_slab_free mm/kasan/common.c:366 [inline]
 ____kasan_slab_free mm/kasan/common.c:328 [inline]
 __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1681 [inline]
 slab_free_freelist_hook+0x7e/0x190 mm/slub.c:1706
 slab_free mm/slub.c:3450 [inline]
 kfree+0xe4/0x530 mm/slub.c:4510
 kref_put include/linux/kref.h:65 [inline]
 bdi_put+0x72/0xa0 mm/backing-dev.c:976
 disk_release+0x7b/0x270 block/genhd.c:1087
 device_release+0x9f/0x240 drivers/base/core.c:2195
 kobject_cleanup lib/kobject.c:705 [inline]
 kobject_release lib/kobject.c:736 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x1c8/0x540 lib/kobject.c:753
 put_device+0x1b/0x30 drivers/base/core.c:3466
 put_disk block/genhd.c:1336 [inline]
 blk_cleanup_disk+0x6b/0x80 block/genhd.c:1352
 loop_remove drivers/block/loop.c:2415 [inline]
 loop_control_remove drivers/block/loop.c:2463 [inline]
 loop_control_ioctl+0x3db/0x450 drivers/block/loop.c:2495
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Last potentially related work creation:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_record_aux_stack+0xe5/0x110 mm/kasan/generic.c:348
 insert_work+0x48/0x370 kernel/workqueue.c:1332
 __queue_work+0x5c1/0xed0 kernel/workqueue.c:1498
 __queue_delayed_work+0x1c8/0x270 kernel/workqueue.c:1645
 mod_delayed_work_on+0xdd/0x220 kernel/workqueue.c:1719
 mod_delayed_work include/linux/workqueue.h:537 [inline]
 wb_shutdown+0x178/0x230 mm/backing-dev.c:360
 bdi_unregister+0x180/0x5a0 mm/backing-dev.c:947
 del_gendisk+0x57e/0x6f0 block/genhd.c:614
 loop_remove drivers/block/loop.c:2414 [inline]
 loop_control_remove drivers/block/loop.c:2463 [inline]
 loop_control_ioctl+0x3b5/0x450 drivers/block/loop.c:2495
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Second to last potentially related work creation:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_record_aux_stack+0xe5/0x110 mm/kasan/generic.c:348
 insert_work+0x48/0x370 kernel/workqueue.c:1332
 __queue_work+0x5c1/0xed0 kernel/workqueue.c:1498
 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
 expire_timers kernel/time/timer.c:1461 [inline]
 __run_timers.part.0+0x49f/0xa20 kernel/time/timer.c:1734
 __run_timers kernel/time/timer.c:1715 [inline]
 run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747
 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558

The buggy address belongs to the object at ffff888146534000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 96 bytes inside of
 4096-byte region [ffff888146534000, ffff888146535000)
The buggy address belongs to the page:
page:ffffea0005194c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x146530
head:ffffea0005194c00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x57ff00000010200(slab|head|node=1|zone=2|lastcpupid=0x7ff)
raw: 057ff00000010200 dead000000000100 dead000000000122 ffff888010c42140
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 7566764109, free_ts 0
 prep_new_page mm/page_alloc.c:2424 [inline]
 get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4151
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5373
 alloc_page_interleave+0x1e/0x200 mm/mempolicy.c:2033
 alloc_pages+0x29f/0x300 mm/mempolicy.c:2183
 alloc_slab_page mm/slub.c:1744 [inline]
 allocate_slab mm/slub.c:1881 [inline]
 new_slab+0x319/0x490 mm/slub.c:1944
 ___slab_alloc+0x8b9/0xf50 mm/slub.c:2961
 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3048
 slab_alloc_node mm/slub.c:3139 [inline]
 slab_alloc mm/slub.c:3181 [inline]
 kmem_cache_alloc_trace+0x305/0x3c0 mm/slub.c:3198
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 kobject_uevent_env+0x240/0x1650 lib/kobject_uevent.c:524
 disk_uevent+0x124/0x480 block/genhd.c:391
 register_disk block/genhd.c:468 [inline]
 device_add_disk+0x940/0xcd0 block/genhd.c:551
 add_disk include/linux/genhd.h:222 [inline]
 brd_alloc+0x484/0x6b0 drivers/block/brd.c:413
 brd_init+0x16f/0x276 drivers/block/brd.c:496
 do_one_initcall+0x103/0x650 init/main.c:1292
 do_initcall_level init/main.c:1367 [inline]
 do_initcalls init/main.c:1383 [inline]
 do_basic_setup init/main.c:1402 [inline]
 kernel_init_freeable+0x6b1/0x73a init/main.c:1604
 kernel_init+0x1a/0x1d0 init/main.c:1496
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888146533f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888146533f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888146534000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff888146534080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888146534100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 1 bytes skipped:
   0:	ff c3                	inc    %ebx
   2:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
   9:	00 00 00 
   c:	0f 1f 40 00          	nopl   0x0(%rax)
  10:	48 89 f8             	mov    %rdi,%rax
  13:	48 89 f7             	mov    %rsi,%rdi
  16:	48 89 d6             	mov    %rdx,%rsi
  19:	48 89 ca             	mov    %rcx,%rdx
  1c:	4d 89 c2             	mov    %r8,%r10
  1f:	4d 89 c8             	mov    %r9,%r8
  22:	4c 8b 4c 24 08       	mov    0x8(%rsp),%r9
  27:	0f 05                	syscall 
  29:	48 3d 01 f0 ff ff    	cmp    $0xfffffffffffff001,%rax <-- trapping instruction
  2f:	73 01                	jae    0x32
  31:	c3                   	retq   
  32:	48 c7 c1 bc ff ff ff 	mov    $0xffffffffffffffbc,%rcx
  39:	f7 d8                	neg    %eax
  3b:	64 89 01             	mov    %eax,%fs:(%rcx)
  3e:	48                   	rex.W