================================================================== BUG: KASAN: use-after-free in disk_unblock_events+0x55/0x60 block/genhd.c:1550 Read of size 8 at addr ffff8801cddc6b60 by task syz-executor079/2085 CPU: 0 PID: 2085 Comm: syz-executor079 Not tainted 4.9.168+ #40 ffff8801d6df7730 ffffffff81b4f5d1 0000000000000000 ffffea0007377000 ffff8801cddc6b60 0000000000000008 ffffffff81b21b35 ffff8801d6df7768 ffffffff81506898 0000000000000000 ffff8801cddc6b60 ffff8801cddc6b60 Call Trace: [<000000005ba6800b>] __dump_stack lib/dump_stack.c:15 [inline] [<000000005ba6800b>] dump_stack+0xc1/0x120 lib/dump_stack.c:51 [<000000003ed305d2>] print_address_description+0x6f/0x23a mm/kasan/report.c:256 [<0000000057f01885>] kasan_report_error mm/kasan/report.c:355 [inline] [<0000000057f01885>] kasan_report mm/kasan/report.c:412 [inline] [<0000000057f01885>] kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:397 [<00000000c319bd70>] __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 [<00000000a65506f5>] disk_unblock_events+0x55/0x60 block/genhd.c:1550 [<00000000ce2b7bfa>] __blkdev_get+0x6ba/0xeb0 fs/block_dev.c:1368 [<0000000008c3e9dc>] blkdev_get+0x2e8/0x920 fs/block_dev.c:1424 [<000000005b373118>] blkdev_open+0x1aa/0x250 fs/block_dev.c:1579 [<00000000d0d52f76>] do_dentry_open+0x422/0xd20 fs/open.c:772 [<0000000043341c86>] vfs_open+0x105/0x230 fs/open.c:885 [<000000002b62e986>] do_last fs/namei.c:3457 [inline] [<000000002b62e986>] path_openat+0xbf5/0x2f60 fs/namei.c:3581 [<000000005cbd3098>] do_filp_open+0x1a1/0x280 fs/namei.c:3615 [<0000000049e4586c>] do_sys_open+0x2f0/0x610 fs/open.c:1078 [<00000000d464c51d>] SYSC_open fs/open.c:1096 [inline] [<00000000d464c51d>] SyS_open+0x2d/0x40 fs/open.c:1091 [<000000000b2d15dc>] do_syscall_64+0x1ad/0x570 arch/x86/entry/common.c:285 [<000000005ecf3c0c>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb Allocated by task 2085: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57 save_stack mm/kasan/kasan.c:505 [inline] set_track mm/kasan/kasan.c:517 [inline] kasan_kmalloc.part.0+0x62/0xf0 mm/kasan/kasan.c:609 kasan_kmalloc+0xb7/0xd0 mm/kasan/kasan.c:594 kmem_cache_alloc_trace+0x115/0x2d0 mm/slub.c:2742 kmem_cache_alloc_node_trace include/linux/slab.h:381 [inline] kmalloc_node include/linux/slab.h:528 [inline] kzalloc_node include/linux/slab.h:647 [inline] alloc_disk_node+0x50/0x3c0 block/genhd.c:1294 alloc_disk+0x1b/0x20 block/genhd.c:1286 loop_add+0x37e/0x7b0 drivers/block/loop.c:1850 loop_control_ioctl+0x138/0x2f0 drivers/block/loop.c:1981 vfs_ioctl fs/ioctl.c:43 [inline] file_ioctl fs/ioctl.c:493 [inline] do_vfs_ioctl+0xb87/0x11d0 fs/ioctl.c:677 SYSC_ioctl fs/ioctl.c:694 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685 do_syscall_64+0x1ad/0x570 arch/x86/entry/common.c:285 entry_SYSCALL_64_after_swapgs+0x5d/0xdb Freed by task 2085: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57 save_stack mm/kasan/kasan.c:505 [inline] set_track mm/kasan/kasan.c:517 [inline] kasan_slab_free+0xb0/0x190 mm/kasan/kasan.c:582 slab_free_hook mm/slub.c:1355 [inline] slab_free_freelist_hook mm/slub.c:1377 [inline] slab_free mm/slub.c:2958 [inline] kfree+0xfc/0x310 mm/slub.c:3878 disk_release+0x255/0x330 block/genhd.c:1147 device_release+0x7d/0x220 drivers/base/core.c:247 kobject_cleanup lib/kobject.c:643 [inline] kobject_release lib/kobject.c:672 [inline] kref_sub include/linux/kref.h:73 [inline] kref_put include/linux/kref.h:98 [inline] kobject_put+0x150/0x260 lib/kobject.c:689 put_disk+0x23/0x30 block/genhd.c:1358 __blkdev_get+0x61a/0xeb0 fs/block_dev.c:1361 blkdev_get+0x2e8/0x920 fs/block_dev.c:1424 blkdev_open+0x1aa/0x250 fs/block_dev.c:1579 do_dentry_open+0x422/0xd20 fs/open.c:772 vfs_open+0x105/0x230 fs/open.c:885 do_last fs/namei.c:3457 [inline] path_openat+0xbf5/0x2f60 fs/namei.c:3581 do_filp_open+0x1a1/0x280 fs/namei.c:3615 do_sys_open+0x2f0/0x610 fs/open.c:1078 SYSC_open fs/open.c:1096 [inline] SyS_open+0x2d/0x40 fs/open.c:1091 do_syscall_64+0x1ad/0x570 arch/x86/entry/common.c:285 entry_SYSCALL_64_after_swapgs+0x5d/0xdb The buggy address belongs to the object at ffff8801cddc6600 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1376 bytes inside of 2048-byte region [ffff8801cddc6600, ffff8801cddc6e00) The buggy address belongs to the page: page:ffffea0007377000 count:1 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 0 flags: 0x4000000000010200(slab|head) page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801cddc6a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801cddc6a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801cddc6b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801cddc6b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801cddc6c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================