================================================================== BUG: KASAN: use-after-free in disk_unblock_events+0x4b/0x50 block/genhd.c:1644 Read of size 8 at addr ffff8881c676e2e8 by task blkid/11437 CPU: 0 PID: 11437 Comm: blkid Not tainted 4.14.156-syzkaller #0 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0xe5/0x154 lib/dump_stack.c:58 print_address_description+0x60/0x226 mm/kasan/report.c:187 __kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316 disk_unblock_events+0x4b/0x50 block/genhd.c:1644 __blkdev_get+0x68f/0xf90 fs/block_dev.c:1556 blkdev_get+0x97/0x8b0 fs/block_dev.c:1612 blkdev_open+0x1cc/0x250 fs/block_dev.c:1770 do_dentry_open+0x44e/0xe20 fs/open.c:789 vfs_open+0x105/0x230 fs/open.c:903 do_last fs/namei.c:3539 [inline] path_openat+0xb6c/0x2be0 fs/namei.c:3681 do_filp_open+0x1a1/0x280 fs/namei.c:3715 do_sys_open+0x2ca/0x590 fs/open.c:1096 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x7f99a17a6120 RSP: 002b:00007ffcc8d8e948 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f99a17a6120 RDX: 00007ffcc8d8ff42 RSI: 0000000000000000 RDI: 00007ffcc8d8ff42 RBP: 0000000000000000 R08: 0000000000000078 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000001ae7030 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000005 Allocated by task 11436: save_stack mm/kasan/common.c:76 [inline] set_track mm/kasan/common.c:85 [inline] __kasan_kmalloc.part.0+0x53/0xc0 mm/kasan/common.c:501 kmem_cache_alloc_node_trace include/linux/slab.h:378 [inline] kmalloc_node include/linux/slab.h:526 [inline] kzalloc_node include/linux/slab.h:672 [inline] alloc_disk_node+0x5b/0x3d0 block/genhd.c:1387 loop_add+0x3ee/0x870 drivers/block/loop.c:1859 loop_probe+0x153/0x180 drivers/block/loop.c:1966 kobj_lookup+0x226/0x410 drivers/base/map.c:124 get_gendisk+0x36/0x240 block/genhd.c:785 bd_start_claiming fs/block_dev.c:1124 [inline] blkdev_get+0x131/0x8b0 fs/block_dev.c:1605 blkdev_open+0x1cc/0x250 fs/block_dev.c:1770 do_dentry_open+0x44e/0xe20 fs/open.c:789 vfs_open+0x105/0x230 fs/open.c:903 do_last fs/namei.c:3539 [inline] path_openat+0xb6c/0x2be0 fs/namei.c:3681 do_filp_open+0x1a1/0x280 fs/namei.c:3715 do_sys_open+0x2ca/0x590 fs/open.c:1096 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 0xffffffffffffffff Freed by task 11437: save_stack mm/kasan/common.c:76 [inline] set_track mm/kasan/common.c:85 [inline] __kasan_slab_free+0x164/0x210 mm/kasan/common.c:463 slab_free_hook mm/slub.c:1407 [inline] slab_free_freelist_hook mm/slub.c:1458 [inline] slab_free mm/slub.c:3039 [inline] kfree+0x108/0x3a0 mm/slub.c:3976 device_release+0xf4/0x1a0 drivers/base/core.c:823 kobject_cleanup lib/kobject.c:646 [inline] kobject_release lib/kobject.c:675 [inline] kref_put include/linux/kref.h:70 [inline] kobject_put+0x142/0x200 lib/kobject.c:692 put_disk+0x1f/0x30 block/genhd.c:1452 __blkdev_get+0x5fa/0xf90 fs/block_dev.c:1549 blkdev_get+0x97/0x8b0 fs/block_dev.c:1612 blkdev_open+0x1cc/0x250 fs/block_dev.c:1770 do_dentry_open+0x44e/0xe20 fs/open.c:789 vfs_open+0x105/0x230 fs/open.c:903 do_last fs/namei.c:3539 [inline] path_openat+0xb6c/0x2be0 fs/namei.c:3681 do_filp_open+0x1a1/0x280 fs/namei.c:3715 do_sys_open+0x2ca/0x590 fs/open.c:1096 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 0xffffffffffffffff The buggy address belongs to the object at ffff8881c676dd80 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1384 bytes inside of 2048-byte region [ffff8881c676dd80, ffff8881c676e580) The buggy address belongs to the page: page:ffffea000719da00 count:1 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 0000000000000000 0000000000000000 00000001000f000f raw: dead000000000100 dead000000000200 ffff8881da802800 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881c676e180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c676e200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881c676e280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881c676e300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c676e380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================