================================================================== BUG: KASAN: use-after-free in get_disk+0xb7/0xd0 block/genhd.c:1433 Read of size 8 at addr ffff8801c86bc930 by task blkid/20822 CPU: 0 PID: 20822 Comm: blkid Not tainted 4.14.78+ #24 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:3408 [inline] path_openat+0x4eb/0x23a0 fs/namei.c:3550 do_filp_open+0x197/0x270 fs/namei.c:3584 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:0x7f6cf9030120 RSP: 002b:00007ffeb354fb18 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f6cf9030120 RDX: 00007ffeb3551f1e RSI: 0000000000000000 RDI: 00007ffeb3551f1e RBP: 0000000000000000 R08: 0000000000000078 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000001e6e030 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000005 Allocated by task 20806: 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_probe+0x14f/0x180 drivers/block/loop.c:1934 kobj_lookup+0x230/0x420 drivers/base/map.c:124 get_gendisk+0x32/0x230 block/genhd.c:785 __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:3408 [inline] path_openat+0x4eb/0x23a0 fs/namei.c:3550 do_filp_open+0x197/0x270 fs/namei.c:3584 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 Freed by task 20809: 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:3408 [inline] path_openat+0x4eb/0x23a0 fs/namei.c:3550 do_filp_open+0x197/0x270 fs/namei.c:3584 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 ffff8801c86bc400 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1328 bytes inside of 2048-byte region [ffff8801c86bc400, ffff8801c86bcc00) The buggy address belongs to the page: page:ffffea000721ae00 count:1 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 0 flags: 0x4000000000008100(slab|head) raw: 4000000000008100 0000000000000000 0000000000000000 00000001000f000f raw: 0000000000000000 0000000500000001 ffff8801da802800 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801c86bc800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801c86bc880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801c86bc900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801c86bc980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801c86bca00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================