bisecting fixing commit since 961f830af0658ef5ef8a7708786d634a6115f16b building syzkaller on 01975a06cb1a7b426ae17985374f2fff3ec38b62 testing commit 961f830af0658ef5ef8a7708786d634a6115f16b with gcc (GCC) 8.1.0 kernel signature: b8c8e2dc62261f9fd4f899510075b972d5d8ca866e8d8843a1d6ddf54280b667 all runs: crashed: KASAN: use-after-free Read in hci_chan_del testing current HEAD ad326970d25cc85128cd22d62398751ad072efff testing commit ad326970d25cc85128cd22d62398751ad072efff with gcc (GCC) 8.1.0 kernel signature: e895be0c9a45ce70e6677525caeb880cad471bc9513d9293f794d6a89e4160f1 all runs: crashed: KASAN: use-after-free Read in hci_chan_del revisions tested: 2, total time: 23m28.121016938s (build: 16m41.324484381s, test: 6m14.943023502s) the crash still happens on HEAD commit msg: Linux 4.19.152 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 ffff8880a54ddb58 by task syz-executor.0/6623 CPU: 0 PID: 6623 Comm: syz-executor.0 Not tainted 4.19.152-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:1683 l2cap_conn_del.isra.23+0x3dc/0x620 net/bluetooth/l2cap_core.c:1739 l2cap_disconn_cfm+0x61/0x80 net/bluetooth/l2cap_core.c:7441 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: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:00007fff70a45388 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000045ce69 RDX: 00000000004168c1 RSI: 00000000016a85f0 RDI: 0000000000000043 RBP: 00000000004c2b1b R08: 000000000000000b R09: 0000000000000000 R10: 00000000023ce940 R11: 0000000000000246 R12: 0000000000000009 R13: 00007fff70a454d0 R14: 000000000000b87d R15: 00007fff70a454e0 Allocated by task 7989: 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:4927 hci_le_enh_conn_complete_evt net/bluetooth/hci_event.c:4969 [inline] hci_le_meta_evt+0x92a/0x3950 net/bluetooth/hci_event.c:5657 hci_event_packet+0x2d31/0x7215 net/bluetooth/hci_event.c:5898 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 7947: 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:595 hci_disconn_loglink_complete_evt net/bluetooth/hci_event.c:4754 [inline] hci_event_packet+0x2e45/0x7215 net/bluetooth/hci_event.c:5919 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 ffff8880a54ddb40 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 24 bytes inside of 128-byte region [ffff8880a54ddb40, ffff8880a54ddbc0) The buggy address belongs to the page: page:ffffea0002953740 count:1 mapcount:0 mapping:ffff88813be9c640 index:0x0 flags: 0xfffe0000000100(slab) raw: 00fffe0000000100 ffffea00028700c8 ffffea0002b1e348 ffff88813be9c640 raw: 0000000000000000 ffff8880a54dd000 0000000100000015 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a54dda00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff8880a54dda80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880a54ddb00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff8880a54ddb80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff8880a54ddc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================