================================================================== BUG: KASAN: use-after-free in disk_unblock_events+0x51/0x60 block/genhd.c:1543 Read of size 8 at addr ffff8801d2157c68 by task blkid/2260 CPU: 0 PID: 2260 Comm: blkid Not tainted 4.4.166+ #4 0000000000000000 d7fc45356407938e ffff8801d1caf6d0 ffffffff81aa62ad ffffea0007485400 ffff8801d2157c68 0000000000000000 ffff8801d2157c68 0000000000000000 ffff8801d1caf708 ffffffff8148b12b ffff8801d2157c68 Call Trace: [] __dump_stack lib/dump_stack.c:15 [inline] [] dump_stack+0xc1/0x124 lib/dump_stack.c:51 [] print_address_description+0x6c/0x217 mm/kasan/report.c:252 [] kasan_report_error mm/kasan/report.c:351 [inline] [] kasan_report.cold.6+0x175/0x2f7 mm/kasan/report.c:408 [] __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:429 [] disk_unblock_events+0x51/0x60 block/genhd.c:1543 [] __blkdev_get+0x70c/0xdf0 fs/block_dev.c:1297 [] blkdev_get+0x2da/0x920 fs/block_dev.c:1353 [] blkdev_open+0x1a5/0x250 fs/block_dev.c:1508 [] do_dentry_open+0x38d/0xbd0 fs/open.c:749 [] vfs_open+0x12a/0x210 fs/open.c:862 [] do_last fs/namei.c:3269 [inline] [] path_openat+0xc10/0x3f10 fs/namei.c:3406 [] do_filp_open+0x197/0x270 fs/namei.c:3440 [] do_sys_open+0x31c/0x610 fs/open.c:1038 [] SYSC_open fs/open.c:1056 [inline] [] SyS_open+0x2d/0x40 fs/open.c:1051 [] entry_SYSCALL_64_fastpath+0x1e/0x9a Allocated by task 2254: [] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63 [] save_stack mm/kasan/kasan.c:512 [inline] [] set_track mm/kasan/kasan.c:524 [inline] [] kasan_kmalloc.part.1+0x62/0xf0 mm/kasan/kasan.c:616 [] kasan_kmalloc+0xaf/0xc0 mm/kasan/kasan.c:601 [] kmem_cache_alloc_trace+0x117/0x2d0 mm/slub.c:2642 [] kmem_cache_alloc_node_trace include/linux/slab.h:367 [inline] [] kmalloc_node include/linux/slab.h:514 [inline] [] kzalloc_node include/linux/slab.h:631 [inline] [] alloc_disk_node+0x54/0x3a0 block/genhd.c:1282 [] alloc_disk+0x18/0x20 block/genhd.c:1274 [] loop_add+0x36b/0x7c0 drivers/block/loop.c:1824 [] loop_control_ioctl+0x136/0x300 drivers/block/loop.c:1956 [] vfs_ioctl fs/ioctl.c:43 [inline] [] file_ioctl fs/ioctl.c:470 [inline] [] do_vfs_ioctl+0x63f/0xf40 fs/ioctl.c:605 [] SYSC_ioctl fs/ioctl.c:622 [inline] [] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:613 [] entry_SYSCALL_64_fastpath+0x1e/0x9a Freed by task 2260: [] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63 [] save_stack mm/kasan/kasan.c:512 [inline] [] set_track mm/kasan/kasan.c:524 [inline] [] kasan_slab_free+0xac/0x190 mm/kasan/kasan.c:589 [] slab_free_hook mm/slub.c:1383 [inline] [] slab_free_freelist_hook mm/slub.c:1405 [inline] [] slab_free mm/slub.c:2859 [inline] [] kfree+0xf4/0x310 mm/slub.c:3749 [] disk_release+0x259/0x330 block/genhd.c:1118 [] device_release+0x7e/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+0x144/0x260 lib/kobject.c:689 [] put_disk+0x23/0x30 block/genhd.c:1346 [] __blkdev_get+0x66c/0xdf0 fs/block_dev.c:1290 [] blkdev_get+0x2da/0x920 fs/block_dev.c:1353 [] blkdev_open+0x1a5/0x250 fs/block_dev.c:1508 [] do_dentry_open+0x38d/0xbd0 fs/open.c:749 [] vfs_open+0x12a/0x210 fs/open.c:862 [] do_last fs/namei.c:3269 [inline] [] path_openat+0xc10/0x3f10 fs/namei.c:3406 [] do_filp_open+0x197/0x270 fs/namei.c:3440 [] do_sys_open+0x31c/0x610 fs/open.c:1038 [] SYSC_open fs/open.c:1056 [inline] [] SyS_open+0x2d/0x40 fs/open.c:1051 [] entry_SYSCALL_64_fastpath+0x1e/0x9a The buggy address belongs to the object at ffff8801d2157700 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1384 bytes inside of 2048-byte region [ffff8801d2157700, ffff8801d2157f00) The buggy address belongs to the page: kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory accessgeneral protection fault: 0000 [#1] PREEMPT SMP KASAN Modules linked in: CPU: 1 PID: 2521 Comm: syz-executor694 Not tainted 4.4.166+ #4 task: ffff8800b22717c0 task.stack: ffff8800b2288000 RIP: 0010:[] [] __debug_check_no_obj_freed lib/debugobjects.c:692 [inline] RIP: 0010:[] [] debug_check_no_obj_freed+0x1a2/0x890 lib/debugobjects.c:729 RSP: 0018:ffff8800b228fc90 EFLAGS: 00010803 RAX: 0000000000000292 RBX: 41e5894855000000 RCX: ffffffff84051f00 RDX: 12dc3d1bf1290161 RSI: 0000000000000002 RDI: ffffffff81426a8d RBP: ffff8800b228fd78 R08: ffff8800b228fd10 R09: dead000000000200 R10: 0000000000061c80 R11: ffffffff831a49f8 R12: 96e1e8df89480b0f R13: ffffffff840ed908 R14: 96e1e8df89480b0f R15: dffffc0000000000 FS: 000000000244d880(0063) GS:ffff8801db700000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000421af0 CR3: 00000000b69ce000 CR4: 00000000001606b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Stack: ffff8800b228fe40 ffff8800b228fdf0 ffffffff840ed900 ffff8801d2aa6000 ffff8801d2aa50b0 0000000000000000 ffff8800b228fdb8 000000000009ba00 fffffbfff081db20 1ffff10016451f9e ffff8801d2aa50a0 ffff8801d2aa5000 Call Trace: [] slab_free_hook mm/slub.c:1376 [inline] [] slab_free_freelist_hook mm/slub.c:1405 [inline] [] slab_free mm/slub.c:2859 [inline] [] kmem_cache_free+0x18f/0x350 mm/slub.c:2881 [] file_free_security security/selinux/hooks.c:306 [inline] [] selinux_file_free_security+0x49/0x60 security/selinux/hooks.c:3222 [] security_file_free+0x4e/0x90 security/security.c:748 [] __fput+0x242/0x6f0 fs/file_table.c:209 [] ____fput+0x15/0x20 fs/file_table.c:244 [] task_work_run+0x21c/0x2d0 kernel/task_work.c:115 [] tracehook_notify_resume include/linux/tracehook.h:191 [inline] [] exit_to_usermode_loop+0x13d/0x160 arch/x86/entry/common.c:188 [] prepare_exit_to_usermode arch/x86/entry/common.c:221 [inline] [] syscall_return_slowpath+0x254/0x2d0 arch/x86/entry/common.c:286 [] int_ret_from_sys_call+0x25/0xa3 Code: 48 c7 c1 00 1f 05 84 4c 8b 34 31 4d 85 f6 0f 84 aa 03 00 00 49 b9 00 02 00 00 00 00 ad de 31 f6 4c 8d 45 98 4c 89 f2 48 c1 ea 03 <42> 80 3c 3a 00 0f 85 90 03 00 00 49 8d 7e 18 83 c6 01 4d 8b 26 RIP [] __debug_check_no_obj_freed lib/debugobjects.c:692 [inline] RIP [] debug_check_no_obj_freed+0x1a2/0x890 lib/debugobjects.c:729 RSP ---[ end trace 7cff5e28a38f99ab ]---