================================================================== BUG: KASAN: use-after-free in disk_unblock_events+0x4b/0x50 block/genhd.c:1644 Read of size 8 at addr ffff8881d5c09ee8 by task syz-executor.0/30680 CPU: 0 PID: 30680 Comm: syz-executor.0 Not tainted 4.14.154+ #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:0x4143d0 RSP: 002b:00007ffe735139a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00000000001086e6 RCX: 00000000004143d0 RDX: 00007ffe73513a3a RSI: 0000000000000002 RDI: 00007ffe73513a30 RBP: 00000000000007be R08: 0000000000000000 R09: 000000000000000a R10: 0000000000000075 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe735139e0 R14: 000000000010867c R15: 00007ffe735139f0 Allocated by task 18726: 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_control_ioctl+0x130/0x310 drivers/block/loop.c:1991 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0xabe/0x1040 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 0xffffffffffffffff Freed by task 30680: 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 ffff8881d5c09980 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1384 bytes inside of 2048-byte region [ffff8881d5c09980, ffff8881d5c0a180) The buggy address belongs to the page: page:ffffea0007570200 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: ffff8881d5c09d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881d5c09e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881d5c09e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881d5c09f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881d5c09f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================