usbhid: USB HID core driver ion_heap_create: Heap type is disabled: 1 kasan: CONFIG_KASAN_INLINE enabled sd 0:0:1:0: [sda] Attached SCSI disk kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] PREEMPT SMP KASAN Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.162+ #99 task: ffff8801da5f8000 task.stack: ffff8801da600000 ================================================================== BUG: KASAN: use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:83 [inline] BUG: KASAN: use-after-free in do_raw_spin_lock+0x1a5/0x1e0 kernel/locking/spinlock_debug.c:112 Read of size 4 at addr ffff8801d673d4b4 by task system/348 CPU: 1 PID: 348 Comm: system Not tainted 4.9.162+ #99 ffff8801d5cbfbc8 ffffffff81b483c1 0000000000000000 ffffea000759cf00 ffff8801d673d4b4 0000000000000004 ffffffff81215865 ffff8801d5cbfc00 ffffffff815033b5 0000000000000000 ffff8801d673d4b4 ffff8801d673d4b4 Call Trace: [] __dump_stack lib/dump_stack.c:15 [inline] [] dump_stack+0xc1/0x120 lib/dump_stack.c:51 [] print_address_description+0x6f/0x238 mm/kasan/report.c:256 [] kasan_report_error mm/kasan/report.c:355 [inline] [] kasan_report mm/kasan/report.c:412 [inline] [] kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:397 [] __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432 [] debug_spin_lock_before kernel/locking/spinlock_debug.c:83 [inline] [] do_raw_spin_lock+0x1a5/0x1e0 kernel/locking/spinlock_debug.c:112 [] __raw_spin_lock include/linux/spinlock_api_smp.h:145 [inline] [] _raw_spin_lock+0x40/0x50 kernel/locking/spinlock.c:151 [] spin_lock include/linux/spinlock.h:302 [inline] [] ion_heap_freelist_size drivers/staging/android/ion/ion_heap.c:176 [inline] [] ion_heap_deferred_free+0xf9/0x560 drivers/staging/android/ion/ion_heap.c:232 [] kthread+0x278/0x310 kernel/kthread.c:211 [] ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:373 Allocated by task 1: 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 kmalloc include/linux/slab.h:490 [inline] kzalloc include/linux/slab.h:636 [inline] ion_system_heap_create+0x42/0x1c0 drivers/staging/android/ion/ion_system_heap.c:334 ion_heap_create+0x156/0x1b0 drivers/staging/android/ion/ion_heap.c:328 ion_dummy_init+0x22e/0x3b6 drivers/staging/android/ion/ion_dummy_driver.c:108 do_one_initcall+0xb1/0x1c0 init/main.c:780 do_initcall_level init/main.c:846 [inline] do_initcalls init/main.c:854 [inline] do_basic_setup init/main.c:872 [inline] kernel_init_freeable+0x2ff/0x3c3 init/main.c:1018 kernel_init+0x12/0x163 init/main.c:946 ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:373 Freed by task 1: 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+0xfb/0x310 mm/slub.c:3878 ion_system_heap_destroy+0x72/0x90 drivers/staging/android/ion/ion_system_heap.c:369 ion_heap_destroy+0x6a/0xd0 drivers/staging/android/ion/ion_heap.c:369 ion_dummy_init+0x30a/0x3b6 drivers/staging/android/ion/ion_dummy_driver.c:118 do_one_initcall+0xb1/0x1c0 init/main.c:780 do_initcall_level init/main.c:846 [inline] do_initcalls init/main.c:854 [inline] do_basic_setup init/main.c:872 [inline] kernel_init_freeable+0x2ff/0x3c3 init/main.c:1018 kernel_init+0x12/0x163 init/main.c:946 ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:373 The buggy address belongs to the object at ffff8801d673d400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 180 bytes inside of 512-byte region [ffff8801d673d400, ffff8801d673d600) The buggy address belongs to the page: page:ffffea000759cf00 count:1 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 0 flags: 0x4000000000004080(slab|head) page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801d673d380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8801d673d400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801d673d480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801d673d500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801d673d580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================