================================================================== BUG: KASAN: use-after-free in get_disk+0xb7/0xd0 block/genhd.c:1433 Read of size 8 at addr ffff88819bd1eb30 by task blkid/8625 CPU: 1 PID: 8625 Comm: blkid Not tainted 4.14.86+ #16 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0xb9/0x11b lib/dump_stack.c:53 print_address_description+0x60/0x22b mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report.cold.6+0x11b/0x2dd mm/kasan/report.c:409 get_disk+0xb7/0xd0 block/genhd.c:1433 get_gendisk+0xe4/0x230 block/genhd.c:793 __blkdev_get+0x345/0xe50 fs/block_dev.c:1446 blkdev_get+0x97/0x8c0 fs/block_dev.c:1604 blkdev_open+0x1bd/0x240 fs/block_dev.c:1762 do_dentry_open+0x426/0xda0 fs/open.c:764 vfs_open+0x11c/0x210 fs/open.c:878 do_last fs/namei.c:3455 [inline] path_openat+0x5f9/0x2930 fs/namei.c:3597 do_filp_open+0x197/0x270 fs/namei.c:3631 do_sys_open+0x2ef/0x580 fs/open.c:1071 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x7f057fec3120 RSP: 002b:00007ffced5a2198 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f057fec3120 RDX: 00007ffced5a2f1a RSI: 0000000000000000 RDI: 00007ffced5a2f1a RBP: 0000000000000000 R08: 0000000000000078 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000f65030 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000005 Allocated by task 8581: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc.part.1+0x4f/0xd0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x138/0x300 mm/slub.c:2750 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+0x5f/0x3b0 block/genhd.c:1387 loop_add+0x3e9/0x840 drivers/block/loop.c:1827 loop_control_ioctl+0x12e/0x310 drivers/block/loop.c:1959 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x1a0/0x1030 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7e/0xb0 fs/ioctl.c:692 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289 entry_SYSCALL_64_after_hwframe+0x42/0xb7 Freed by task 1842: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xac/0x190 mm/kasan/kasan.c:524 slab_free_hook mm/slub.c:1389 [inline] slab_free_freelist_hook mm/slub.c:1410 [inline] slab_free mm/slub.c:2966 [inline] kfree+0xf5/0x310 mm/slub.c:3897 device_release+0xf4/0x1a0 drivers/base/core.c:822 kobject_cleanup lib/kobject.c:646 [inline] kobject_release lib/kobject.c:675 [inline] kref_put include/linux/kref.h:70 [inline] kobject_put+0x146/0x200 lib/kobject.c:692 put_disk+0x1f/0x30 block/genhd.c:1452 __blkdev_get+0x564/0xe50 fs/block_dev.c:1562 blkdev_get+0x97/0x8c0 fs/block_dev.c:1604 blkdev_open+0x1bd/0x240 fs/block_dev.c:1762 do_dentry_open+0x426/0xda0 fs/open.c:764 vfs_open+0x11c/0x210 fs/open.c:878 do_last fs/namei.c:3455 [inline] path_openat+0x5f9/0x2930 fs/namei.c:3597 do_filp_open+0x197/0x270 fs/namei.c:3631 do_sys_open+0x2ef/0x580 fs/open.c:1071 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289 entry_SYSCALL_64_after_hwframe+0x42/0xb7 The buggy address belongs to the object at ffff88819bd1e600 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1328 bytes inside of 2048-byte region [ffff88819bd1e600, ffff88819bd1ee00) The buggy address belongs to the page: page:ffffea00066f4600 count:1 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 0 flags: 0x4000000000008100(slab|head) raw: 4000000000008100 0000000000000000 0000000000000000 00000001000f000f raw: ffffea0006744c00 0000000300000003 ffff8881da802800 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88819bd1ea00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88819bd1ea80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88819bd1eb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88819bd1eb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88819bd1ec00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================