bisecting fixing commit since 961f830af0658ef5ef8a7708786d634a6115f16b building syzkaller on 01975a06cb1a7b426ae17985374f2fff3ec38b62 testing commit 961f830af0658ef5ef8a7708786d634a6115f16b with gcc (GCC) 8.4.1 20210217 kernel signature: 387d346021d38929378a91404ec649eb780952fdd89f8e6f4e1d3c38966564d0 all runs: crashed: KASAN: use-after-free Read in hci_chan_del testing current HEAD 2034d6f0838e465dd8f120c4e946d8444b4bb5df testing commit 2034d6f0838e465dd8f120c4e946d8444b4bb5df with gcc (GCC) 8.4.1 20210217 kernel signature: 76a03edfc638cfae24d62723d76982667817757cdfb5146b607c48c88bff54db all runs: crashed: KASAN: use-after-free Read in hci_chan_del revisions tested: 2, total time: 23m20.491170955s (build: 16m39.177035763s, test: 6m15.253451453s) the crash still happens on HEAD commit msg: Linux 4.19.184 crash: KASAN: use-after-free Read in hci_chan_del batman_adv: batadv0: Interface activated: batadv_slave_1 IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready ================================================================== BUG: KASAN: use-after-free in hci_chan_del+0x12b/0x170 net/bluetooth/hci_conn.c:1683 Read of size 8 at addr ffff8881d8fd1918 by task syz-executor.1/5905 CPU: 0 PID: 5905 Comm: syz-executor.1 Not tainted 4.19.184-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/0x226 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 mm/kasan/report.c:412 [inline] kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:396 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 hci_chan_del+0x12b/0x170 net/bluetooth/hci_conn.c:1683 l2cap_conn_del.isra.23+0x3dc/0x620 net/bluetooth/l2cap_core.c:1739 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:7441 [inline] l2cap_disconn_cfm+0x61/0x80 net/bluetooth/l2cap_core.c:7434 hci_disconn_cfm include/net/bluetooth/hci_core.h:1261 [inline] hci_conn_hash_flush+0x10b/0x200 net/bluetooth/hci_conn.c:1512 hci_dev_do_close+0x4d2/0xcd0 net/bluetooth/hci_core.c:1668 hci_unregister_dev+0x163/0x7a0 net/bluetooth/hci_core.c:3273 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/0x2d90 kernel/exit.c:870 do_group_exit+0xf8/0x2c0 kernel/exit.c:967 __do_sys_exit_group kernel/exit.c:978 [inline] __se_sys_exit_group kernel/exit.c:976 [inline] __x64_sys_exit_group+0x39/0x40 kernel/exit.c:976 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x464909 Code: Bad RIP value. RSP: 002b:00007ffcf040be98 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 000000000000002e RCX: 0000000000464909 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000043 RBP: 00000000004ae1ea R08: 000000000000000b R09: 000000000000cb25 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000cb3b R14: 000000000000cb25 R15: 0000000000000009 Allocated by task 1231: 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:1668 l2cap_conn_add.part.17+0x15/0xb80 net/bluetooth/l2cap_core.c:7062 l2cap_conn_add net/bluetooth/l2cap_core.c:97 [inline] l2cap_connect_cfm+0x339/0xd50 net/bluetooth/l2cap_core.c:7379 hci_connect_cfm include/net/bluetooth/hci_core.h:1246 [inline] le_conn_complete_evt+0xec2/0x14a0 net/bluetooth/hci_event.c:4932 hci_le_enh_conn_complete_evt net/bluetooth/hci_event.c:4974 [inline] hci_le_meta_evt+0x92e/0x39a0 net/bluetooth/hci_event.c:5660 hci_event_packet+0x2d31/0x7230 net/bluetooth/hci_event.c:5901 hci_rx_work+0x363/0x8f0 net/bluetooth/hci_core.c:4361 process_one_work+0x7b9/0x15a0 kernel/workqueue.c:2152 worker_thread+0x85/0xb60 kernel/workqueue.c:2295 kthread+0x347/0x410 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 Freed by task 7226: 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:1698 amp_destroy_logical_link+0x9/0x10 net/bluetooth/amp.c:598 hci_disconn_loglink_complete_evt net/bluetooth/hci_event.c:4759 [inline] hci_event_packet+0x2e45/0x7230 net/bluetooth/hci_event.c:5922 hci_rx_work+0x363/0x8f0 net/bluetooth/hci_core.c:4361 process_one_work+0x7b9/0x15a0 kernel/workqueue.c:2152 worker_thread+0x85/0xb60 kernel/workqueue.c:2295 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 ffff8881d8fd1900 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 24 bytes inside of 128-byte region [ffff8881d8fd1900, ffff8881d8fd1980) The buggy address belongs to the page: page:ffffea000763f440 count:1 mapcount:0 mapping:ffff8881f6400640 index:0x0 flags: 0x17ffe0000000100(slab) raw: 017ffe0000000100 ffffea000764c5c8 ffffea0007651f88 ffff8881f6400640 raw: 0000000000000000 ffff8881d8fd1000 0000000100000015 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881d8fd1800: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ffff8881d8fd1880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff8881d8fd1900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881d8fd1980: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ffff8881d8fd1a00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ================================================================== list_del corruption, ffff8881d8fd1900->prev is LIST_POISON2 (dead000000000200) ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:50! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 5905 Comm: syz-executor.1 Tainted: G B 4.19.184-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:__list_del_entry_valid.cold.1+0x12/0x4a lib/list_debug.c:48 Code: f9 ff 0f 0b 48 89 f1 48 c7 c7 00 9f 67 87 48 89 de e8 fb 67 f9 ff 0f 0b 4c 89 e2 48 89 de 48 c7 c7 40 a0 67 87 e8 e7 67 f9 ff <0f> 0b 4c 89 ea 48 89 de 48 c7 c7 e0 9f 67 87 e8 d3 67 f9 ff 0f 0b RSP: 0018:ffff8881e86af9e0 EFLAGS: 00010282 RAX: 000000000000004e RBX: ffff8881d8fd1900 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff87679d40 RDI: ffffffff8a1a0aa0 RBP: ffff8881e86af9f8 R08: ffffed103ed25081 R09: ffffed103ed25080 R10: ffffed103ed25080 R11: ffff8881f6928407 R12: dead000000000200 R13: ffff8881db7bad00 R14: ffff8881db221d68 R15: ffffffff8908a1a0 FS: 0000000002837400(0000) GS:ffff8881f6800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f9739428000 CR3: 000000000846d004 CR4: 00000000001606f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __list_del_entry include/linux/list.h:117 [inline] list_del_rcu include/linux/rculist.h:130 [inline] hci_chan_del+0x3f/0x170 net/bluetooth/hci_conn.c:1688 l2cap_conn_del.isra.23+0x3dc/0x620 net/bluetooth/l2cap_core.c:1739 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:7441 [inline] l2cap_disconn_cfm+0x61/0x80 net/bluetooth/l2cap_core.c:7434 hci_disconn_cfm include/net/bluetooth/hci_core.h:1261 [inline] hci_conn_hash_flush+0x10b/0x200 net/bluetooth/hci_conn.c:1512 hci_dev_do_close+0x4d2/0xcd0 net/bluetooth/hci_core.c:1668 hci_unregister_dev+0x163/0x7a0 net/bluetooth/hci_core.c:3273 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/0x2d90 kernel/exit.c:870 do_group_exit+0xf8/0x2c0 kernel/exit.c:967 __do_sys_exit_group kernel/exit.c:978 [inline] __se_sys_exit_group kernel/exit.c:976 [inline] __x64_sys_exit_group+0x39/0x40 kernel/exit.c:976 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x464909 Code: Bad RIP value. RSP: 002b:00007ffcf040be98 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 000000000000002e RCX: 0000000000464909 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000043 RBP: 00000000004ae1ea R08: 000000000000000b R09: 000000000000cb25 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000cb3b R14: 000000000000cb25 R15: 0000000000000009 Modules linked in: ---[ end trace d30ee5cbd233eb7c ]--- RIP: 0010:__list_del_entry_valid.cold.1+0x12/0x4a lib/list_debug.c:48 Code: f9 ff 0f 0b 48 89 f1 48 c7 c7 00 9f 67 87 48 89 de e8 fb 67 f9 ff 0f 0b 4c 89 e2 48 89 de 48 c7 c7 40 a0 67 87 e8 e7 67 f9 ff <0f> 0b 4c 89 ea 48 89 de 48 c7 c7 e0 9f 67 87 e8 d3 67 f9 ff 0f 0b RSP: 0018:ffff8881e86af9e0 EFLAGS: 00010282 RAX: 000000000000004e RBX: ffff8881d8fd1900 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff87679d40 RDI: ffffffff8a1a0aa0 RBP: ffff8881e86af9f8 R08: ffffed103ed25081 R09: ffffed103ed25080 R10: ffffed103ed25080 R11: ffff8881f6928407 R12: dead000000000200 R13: ffff8881db7bad00 R14: ffff8881db221d68 R15: ffffffff8908a1a0 FS: 0000000002837400(0000) GS:ffff8881f6800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000004648df CR3: 000000000846d004 CR4: 00000000001606f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400