==================================================================
BUG: KASAN: use-after-free in bdev_nr_sectors include/linux/genhd.h:266 [inline]
BUG: KASAN: use-after-free in disk_part_iter_next+0x1e3/0x4a0 block/genhd.c:206
Read of size 8 at addr ffff8880327fae28 by task systemd-udevd/4821

CPU: 1 PID: 4821 Comm: systemd-udevd Not tainted 5.12.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x176/0x24e lib/dump_stack.c:120
 print_address_description+0x5f/0x3a0 mm/kasan/report.c:232
 __kasan_report mm/kasan/report.c:399 [inline]
 kasan_report+0x15c/0x200 mm/kasan/report.c:416
 bdev_nr_sectors include/linux/genhd.h:266 [inline]
 disk_part_iter_next+0x1e3/0x4a0 block/genhd.c:206
 blk_drop_partitions+0x1c5/0x250 block/partitions/core.c:541
 bdev_disk_changed+0x128/0x3c0 fs/block_dev.c:1246
 __blkdev_get+0x4e3/0xa60 fs/block_dev.c:1350
 blkdev_get_by_dev+0x11a/0x6d0 fs/block_dev.c:1454
 blkdev_reread_part block/ioctl.c:100 [inline]
 blkdev_common_ioctl+0x12bc/0x1bf0 block/ioctl.c:508
 blkdev_ioctl+0x23c/0x600 block/ioctl.c:577
 block_ioctl+0xae/0xf0 fs/block_dev.c:1667
 vfs_ioctl fs/ioctl.c:48 [inline]
 __do_sys_ioctl fs/ioctl.c:753 [inline]
 __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:739
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fc94d931017
Code: 00 00 00 48 8b 05 81 7e 2b 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 51 7e 2b 00 f7 d8 64 89 01 48
RSP: 002b:00007ffe973a4e28 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ffe973a4ec0 RCX: 00007fc94d931017
RDX: 0000000000000000 RSI: 000000000000125f RDI: 000000000000000e
RBP: 00007ffe973a5400 R08: 0000000000000000 R09: 0000000000000010
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe973a4fd0
R13: 000056339932c010 R14: 0000563399339ea0 R15: 00007ffe973a4ea0

Allocated by task 9987:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:427 [inline]
 __kasan_slab_alloc+0x8f/0xc0 mm/kasan/common.c:460
 kasan_slab_alloc include/linux/kasan.h:223 [inline]
 slab_post_alloc_hook mm/slab.h:516 [inline]
 slab_alloc_node mm/slub.c:2907 [inline]
 slab_alloc mm/slub.c:2915 [inline]
 kmem_cache_alloc+0x1c3/0x350 mm/slub.c:2920
 bdev_alloc_inode+0x17/0x80 fs/block_dev.c:795
 alloc_inode fs/inode.c:234 [inline]
 new_inode_pseudo+0x61/0x220 fs/inode.c:928
 new_inode+0x25/0x1d0 fs/inode.c:957
 bdev_alloc+0x20/0x290 fs/block_dev.c:885
 add_partition+0x13c/0x790 block/partitions/core.c:346
 bdev_add_partition+0x1a8/0x1f0 block/partitions/core.c:449
 blkpg_do_ioctl+0x29d/0x300 block/ioctl.c:43
 blkpg_ioctl block/ioctl.c:60 [inline]
 blkdev_ioctl+0x36d/0x600 block/ioctl.c:548
 block_ioctl+0xae/0xf0 fs/block_dev.c:1667
 vfs_ioctl fs/ioctl.c:48 [inline]
 __do_sys_ioctl fs/ioctl.c:753 [inline]
 __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:739
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 19:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x3d/0x70 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:357
 ____kasan_slab_free+0x100/0x140 mm/kasan/common.c:360
 kasan_slab_free include/linux/kasan.h:199 [inline]
 slab_free_hook mm/slub.c:1562 [inline]
 slab_free_freelist_hook+0x171/0x270 mm/slub.c:1600
 slab_free mm/slub.c:3161 [inline]
 kmem_cache_free+0x85/0x170 mm/slub.c:3177
 rcu_do_batch kernel/rcu/tree.c:2559 [inline]
 rcu_core+0x858/0x1360 kernel/rcu/tree.c:2794
 __do_softirq+0x318/0x714 kernel/softirq.c:345

Last potentially related work creation:
 kasan_save_stack+0x27/0x50 mm/kasan/common.c:38
 kasan_record_aux_stack+0xee/0x120 mm/kasan/generic.c:345
 __call_rcu kernel/rcu/tree.c:3039 [inline]
 call_rcu+0x130/0x8e0 kernel/rcu/tree.c:3114
 disk_part_iter_exit block/genhd.c:235 [inline]
 disk_part_iter_next+0x61/0x4a0 block/genhd.c:202
 blk_drop_partitions+0x1c5/0x250 block/partitions/core.c:541
 bdev_disk_changed+0x128/0x3c0 fs/block_dev.c:1246
 loop_reread_partitions drivers/block/loop.c:655 [inline]
 loop_set_status+0xa2a/0xd00 drivers/block/loop.c:1418
 lo_ioctl+0xb56/0x20b0 drivers/block/loop.c:1528
 blkdev_ioctl+0x2e1/0x600 block/ioctl.c:583
 block_ioctl+0xae/0xf0 fs/block_dev.c:1667
 vfs_ioctl fs/ioctl.c:48 [inline]
 __do_sys_ioctl fs/ioctl.c:753 [inline]
 __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:739
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff8880327fae00
 which belongs to the cache bdev_cache of size 2792
The buggy address is located 40 bytes inside of
 2792-byte region [ffff8880327fae00, ffff8880327fb8e8)
The buggy address belongs to the page:
page:ffffea0000c9fe00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880327fdc00 pfn:0x327f8
head:ffffea0000c9fe00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888140006c80
raw: ffff8880327fdc00 00000000800b0003 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880327fad00: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
 ffff8880327fad80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880327fae00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff8880327fae80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880327faf00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================