BUG: KASAN: use-after-free in do_blk_trace_setup+0xab4/0xcf0 kernel/trace/blktrace.c:546 Read of size 8 at addr ffff88006ab62d00 by task syzkaller556741/3013 CPU: 3 PID: 3013 Comm: syzkaller556741 Not tainted 4.14.0-rc7-next-20171103+ #10 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 print_address_description+0x73/0x250 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report+0x25b/0x340 mm/kasan/report.c:409 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 do_blk_trace_setup+0xab4/0xcf0 kernel/trace/blktrace.c:546 blk_trace_setup+0xbd/0x180 kernel/trace/blktrace.c:564 sg_ioctl+0xc77/0x2da0 drivers/scsi/sg.c:1089 vfs_ioctl fs/ioctl.c:46 [inline] do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:686 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692 entry_SYSCALL_64_fastpath+0x1f/0xbe RIP: 0033:0x4396a9 RSP: 002b:00007ffccd250068 EFLAGS: 00000206 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00000000006ccac0 RCX: 00000000004396a9 RDX: 000000002084cf90 RSI: 00000000c0481273 RDI: 0000000000000004 RBP: 0000000000000086 R08: 00000000000000fe R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000038 R13: ffffffffffffffff R14: 0000000000401eb0 R15: 0000000000000000 Allocated by task 3013: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3615 kmalloc include/linux/slab.h:500 [inline] kzalloc include/linux/slab.h:689 [inline] do_blk_trace_setup+0x182/0xcf0 kernel/trace/blktrace.c:479 blk_trace_setup+0xbd/0x180 kernel/trace/blktrace.c:564 sg_ioctl+0xc77/0x2da0 drivers/scsi/sg.c:1089 vfs_ioctl fs/ioctl.c:46 [inline] do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:686 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692 entry_SYSCALL_64_fastpath+0x1f/0xbe Freed by task 3020: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3493 [inline] kfree+0xca/0x250 mm/slab.c:3808 blk_trace_free+0xf9/0x130 kernel/trace/blktrace.c:329 blk_trace_cleanup+0x15/0x30 kernel/trace/blktrace.c:334 blk_trace_remove+0x55/0x80 kernel/trace/blktrace.c:348 sg_ioctl+0x5f1/0x2da0 drivers/scsi/sg.c:1098 vfs_ioctl fs/ioctl.c:46 [inline] do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:686 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692 entry_SYSCALL_64_fastpath+0x1f/0xbe The buggy address belongs to the object at ffff88006ab62cc0 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 64 bytes inside of 128-byte region [ffff88006ab62cc0, ffff88006ab62d40) The buggy address belongs to the page: page:ffffea0001aad880 count:1 mapcount:0 mapping:ffff88006ab62000 index:0xffff88006ab62000 flags: 0x500000000000100(slab) raw: 0500000000000100 ffff88006ab62000 ffff88006ab62000 0000000100000014 raw: ffffea0001ad3260 ffffea0001acbaa0 ffff88003e800640 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88006ab62c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88006ab62c80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb >ffff88006ab62d00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88006ab62d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88006ab62e00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ==================================================================