loop0: detected capacity change from 0 to 512
EXT4-fs error (device loop0): ext4_fill_super:4953: inode #2: comm syz-executor236: iget: root inode unallocated
EXT4-fs (loop0): get root inode failed
EXT4-fs (loop0): mount failed
==================================================================
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:832
Read of size 8 at addr ffff88801aee2060 by task syz-executor236/6849

CPU: 0 PID: 6849 Comm: syz-executor236 Not tainted 5.14.0-rc5-next-20210810-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:832
 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:2193
 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:3463
 put_disk block/genhd.c:1338 [inline]
 blk_cleanup_disk+0x6b/0x80 block/genhd.c:1354
 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:0x4446d9
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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe16bebe28 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000001152a RCX: 00000000004446d9
RDX: 0000000000000000 RSI: 0000000000004c81 RDI: 0000000000000003
RBP: 0000000000000000 R08: 00000000004af080 R09: 00000000004af080
R10: 00000000004af080 R11: 0000000000000246 R12: 00007ffe16bebe50
R13: 00007ffe16bebe3c R14: 431bde82d7b634db R15: 00000000004004a0

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:1270
 __blk_mq_alloc_disk+0xec/0x190 block/blk-mq.c:3145
 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:1285
 do_initcall_level init/main.c:1360 [inline]
 do_initcalls init/main.c:1376 [inline]
 do_basic_setup init/main.c:1395 [inline]
 kernel_init_freeable+0x6b1/0x73a init/main.c:1597
 kernel_init+0x1a/0x1d0 init/main.c:1489
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Freed by task 6849:
 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:3444 [inline]
 kfree+0xe4/0x530 mm/slub.c:4504
 kref_put include/linux/kref.h:65 [inline]
 bdi_put+0x72/0xa0 mm/backing-dev.c:976
 disk_release+0x7b/0x270 block/genhd.c:1089
 device_release+0x9f/0x240 drivers/base/core.c:2193
 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:3463
 put_disk block/genhd.c:1338 [inline]
 blk_cleanup_disk+0x6b/0x80 block/genhd.c:1354
 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
 flush_delayed_work+0xc6/0xf0 kernel/workqueue.c:3195
 wb_shutdown+0x1bb/0x230 mm/backing-dev.c:363
 bdi_unregister+0x180/0x5a0 mm/backing-dev.c:947
 del_gendisk+0x5a6/0x730 block/genhd.c:616
 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
 __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+0x5a6/0x730 block/genhd.c:616
 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

The buggy address belongs to the object at ffff88801aee2000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 96 bytes inside of
 4096-byte region [ffff88801aee2000, ffff88801aee3000)
The buggy address belongs to the page:
page:ffffea00006bb800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1aee0
head:ffffea00006bb800 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 0000000300000001 ffff888010842140
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 7546472052, free_ts 0
 prep_new_page mm/page_alloc.c:2424 [inline]
 get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4152
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5374
 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:2955
 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3042
 slab_alloc_node mm/slub.c:3133 [inline]
 slab_alloc mm/slub.c:3175 [inline]
 kmem_cache_alloc_trace+0x305/0x3c0 mm/slub.c:3192
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 kobject_uevent_env+0x240/0x1650 lib/kobject_uevent.c:524
 device_add+0xbc6/0x21b0 drivers/base/core.c:3337
 device_create_groups_vargs+0x203/0x280 drivers/base/core.c:4014
 device_create_with_groups+0xe3/0x120 drivers/base/core.c:4100
 misc_register+0x20a/0x690 drivers/char/misc.c:206
 loop_init+0x17a/0x216 drivers/block/loop.c:2563
 do_one_initcall+0x103/0x650 init/main.c:1285
 do_initcall_level init/main.c:1360 [inline]
 do_initcalls init/main.c:1376 [inline]
 do_basic_setup init/main.c:1395 [inline]
 kernel_init_freeable+0x6b1/0x73a init/main.c:1597
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88801aee1f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88801aee1f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88801aee2000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff88801aee2080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801aee2100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================