bisecting fixing commit since 961f830af0658ef5ef8a7708786d634a6115f16b building syzkaller on 01975a06cb1a7b426ae17985374f2fff3ec38b62 testing commit 961f830af0658ef5ef8a7708786d634a6115f16b with gcc (GCC) 8.1.0 kernel signature: bc6bfb23515a0d6a6a0dc1d31e4cb8f0ac630ecb759f4d35568e5652949dc321 all runs: crashed: KASAN: use-after-free Read in hci_chan_del testing current HEAD c37da90efff5f183bea6ae4c2af33571f61fe317 testing commit c37da90efff5f183bea6ae4c2af33571f61fe317 with gcc (GCC) 8.1.0 kernel signature: 5879bb9cac99a8fb9fb8d9855693907d28278511e86c39dec3c987da0e7a5845 all runs: crashed: KASAN: use-after-free Read in hci_chan_del revisions tested: 2, total time: 29m10.404778329s (build: 21m25.370775361s, test: 6m10.311752171s) the crash still happens on HEAD commit msg: Linux 4.19.143 crash: KASAN: use-after-free Read in hci_chan_del Bluetooth: hci1: command 0x0409 tx timeout Bluetooth: hci3: command 0x0409 tx timeout Bluetooth: hci4: command 0x0409 tx timeout Bluetooth: hci5: command 0x0409 tx timeout ================================================================== BUG: KASAN: use-after-free in hci_chan_del+0x12b/0x170 net/bluetooth/hci_conn.c:1666 Read of size 8 at addr ffff88808b4c70d8 by task syz-executor.0/6625 CPU: 0 PID: 6625 Comm: syz-executor.0 Not tainted 4.19.143-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x17c/0x22a lib/dump_stack.c:118 print_address_description.cold.6+0x9/0x211 mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.7+0x242/0x307 mm/kasan/report.c:412 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 hci_chan_del+0x12b/0x170 net/bluetooth/hci_conn.c:1666 l2cap_conn_del.isra.23+0x3dc/0x630 net/bluetooth/l2cap_core.c:1736 l2cap_disconn_cfm+0x61/0x80 net/bluetooth/l2cap_core.c:7435 hci_disconn_cfm include/net/bluetooth/hci_core.h:1261 [inline] hci_conn_hash_flush+0x10b/0x200 net/bluetooth/hci_conn.c:1495 hci_dev_do_close+0x4d2/0xcd0 net/bluetooth/hci_core.c:1666 hci_unregister_dev+0x163/0x7a0 net/bluetooth/hci_core.c:3271 vhci_release+0x6b/0xe0 drivers/bluetooth/hci_vhci.c:354 __fput+0x249/0x7f0 fs/file_table.c:278 ____fput+0x9/0x10 fs/file_table.c:309 task_work_run+0x108/0x180 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0xa6a/0x2db0 kernel/exit.c:887 do_group_exit+0xf8/0x2c0 kernel/exit.c:990 __do_sys_exit_group kernel/exit.c:1001 [inline] __se_sys_exit_group kernel/exit.c:999 [inline] __x64_sys_exit_group+0x39/0x40 kernel/exit.c:999 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45ce69 Code: 2d b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 fb b5 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007fff0ea5f5f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000045ce69 RDX: 00000000004168c1 RSI: 00000000016a85f0 RDI: 0000000000000043 RBP: 00000000004c2b1b R08: 000000000000000b R09: 0000000000000000 R10: 00000000032c5940 R11: 0000000000000246 R12: 0000000000000009 R13: 00007fff0ea5f740 R14: 000000000000ca68 R15: 00007fff0ea5f750 Allocated by task 1225: save_stack mm/kasan/kasan.c:448 [inline] set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc.part.1+0x62/0xf0 mm/kasan/kasan.c:553 kasan_kmalloc+0xaf/0xc0 mm/kasan/kasan.c:538 kmem_cache_alloc_trace+0x152/0x3a0 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] hci_chan_create+0x7b/0x2e0 net/bluetooth/hci_conn.c:1651 l2cap_conn_add.part.17+0x15/0xb80 net/bluetooth/l2cap_core.c:7056 l2cap_conn_add net/bluetooth/l2cap_core.c:97 [inline] l2cap_connect_cfm+0x339/0xd50 net/bluetooth/l2cap_core.c:7373 hci_connect_cfm include/net/bluetooth/hci_core.h:1246 [inline] le_conn_complete_evt+0xec2/0x14a0 net/bluetooth/hci_event.c:4938 hci_le_enh_conn_complete_evt net/bluetooth/hci_event.c:4980 [inline] hci_le_meta_evt+0x92a/0x3950 net/bluetooth/hci_event.c:5668 hci_event_packet+0x1934/0x7174 net/bluetooth/hci_event.c:5904 hci_rx_work+0x31b/0x8e0 net/bluetooth/hci_core.c:4359 process_one_work+0x7b9/0x15a0 kernel/workqueue.c:2155 worker_thread+0x85/0xb60 kernel/workqueue.c:2298 kthread+0x347/0x410 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 Freed by task 7950: save_stack mm/kasan/kasan.c:448 [inline] set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x13c/0x220 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3503 [inline] kfree+0xcf/0x220 mm/slab.c:3822 hci_chan_del+0x11b/0x170 net/bluetooth/hci_conn.c:1681 amp_destroy_logical_link+0x9/0x10 net/bluetooth/amp.c:595 hci_disconn_loglink_complete_evt net/bluetooth/hci_event.c:4765 [inline] hci_event_packet+0x259a/0x7174 net/bluetooth/hci_event.c:5925 hci_rx_work+0x31b/0x8e0 net/bluetooth/hci_core.c:4359 process_one_work+0x7b9/0x15a0 kernel/workqueue.c:2155 worker_thread+0x85/0xb60 kernel/workqueue.c:2298 kthread+0x347/0x410 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 The buggy address belongs to the object at ffff88808b4c70c0 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 24 bytes inside of 128-byte region [ffff88808b4c70c0, ffff88808b4c7140) The buggy address belongs to the page: page:ffffea00022d31c0 count:1 mapcount:0 mapping:ffff88812c29c640 index:0x0 flags: 0xfffe0000000100(slab) raw: 00fffe0000000100 ffffea00022db148 ffffea00023e5488 ffff88812c29c640 raw: 0000000000000000 ffff88808b4c7000 0000000100000015 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88808b4c6f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88808b4c7000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88808b4c7080: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff88808b4c7100: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88808b4c7180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================