================================================================== BUG: KASAN: slab-use-after-free in hci_conn_hash_flush+0x201/0x240 Read of size 8 at addr ffff88803ebb6000 by task syz-executor.4/13127 CPU: 1 PID: 13127 Comm: syz-executor.4 Not tainted 6.3.0-rc7-next-20230419 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x91/0xf0 print_report+0xcc/0x620 kasan_report+0xc0/0xf0 hci_conn_hash_flush+0x201/0x240 hci_dev_close_sync+0x57f/0xff0 hci_rfkill_set_block+0x17b/0x1c0 rfkill_set_block+0x1fd/0x540 rfkill_fop_write+0x2b7/0x540 vfs_write+0x2d8/0xdd0 ksys_write+0x1f4/0x260 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7f31d6810b19 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f31d3d86188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f31d6923f60 RCX: 00007f31d6810b19 RDX: 0000000000000008 RSI: 0000000020000080 RDI: 0000000000000003 RBP: 00007f31d686af6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffecb7a72bf R14: 00007f31d3d86300 R15: 0000000000022000 Allocated by task 8289: kasan_save_stack+0x22/0x50 kasan_set_track+0x25/0x30 __kasan_kmalloc+0x7f/0x90 hci_conn_add+0xa3/0x14d0 hci_connect_sco+0x3e7/0x1120 sco_sock_connect+0x2c0/0x9c0 __sys_connect_file+0x159/0x1a0 __sys_connect+0x169/0x1a0 __x64_sys_connect+0x73/0xb0 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc Freed by task 13127: kasan_save_stack+0x22/0x50 kasan_set_track+0x25/0x30 kasan_save_free_info+0x2e/0x50 __kasan_slab_free+0x10a/0x190 __kmem_cache_free+0xd1/0x2f0 device_release+0xa6/0x240 kobject_put+0x177/0x270 put_device+0x1f/0x30 hci_conn_del+0x29f/0x810 hci_conn_unlink+0x211/0x390 hci_conn_unlink+0x2a3/0x390 hci_conn_hash_flush+0x195/0x240 hci_dev_close_sync+0x57f/0xff0 hci_rfkill_set_block+0x17b/0x1c0 rfkill_set_block+0x1fd/0x540 rfkill_fop_write+0x2b7/0x540 vfs_write+0x2d8/0xdd0 ksys_write+0x1f4/0x260 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc Last potentially related work creation: kasan_save_stack+0x22/0x50 __kasan_record_aux_stack+0x95/0xb0 __queue_work+0x622/0x12f0 __queue_delayed_work+0x1c8/0x270 queue_delayed_work_on+0xcd/0xd0 sco_chan_del+0x1db/0x440 __sco_sock_close+0x21e/0x770 sco_sock_release+0xa1/0x400 __sock_release+0xd2/0x2a0 sock_close+0x1c/0x30 __fput+0x263/0xa40 task_work_run+0x174/0x280 get_signal+0x1d3/0x26c0 arch_do_signal_or_restart+0x79/0x590 exit_to_user_mode_prepare+0xeb/0x180 syscall_exit_to_user_mode+0x1d/0x50 do_syscall_64+0x4c/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc The buggy address belongs to the object at ffff88803ebb6000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 0 bytes inside of freed 4096-byte region [ffff88803ebb6000, ffff88803ebb7000) The buggy address belongs to the physical page: page:0000000054a68740 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3ebb0 head:0000000054a68740 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x100000000010200(slab|head|node=0|zone=1) page_type: 0xffffffff() raw: 0100000000010200 ffff888008442140 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88803ebb5f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88803ebb5f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88803ebb6000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803ebb6080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803ebb6100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== general protection fault, probably for non-canonical address 0xe08adc4fa0000668: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: maybe wild-memory-access in range [0x0457027d00003340-0x0457027d00003347] CPU: 1 PID: 13127 Comm: syz-executor.4 Tainted: G B 6.3.0-rc7-next-20230419 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:hci_conn_cleanup+0x1c5/0x780 Code: fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 ef 04 00 00 48 89 da 49 89 5c 24 08 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 ab 04 00 00 48 b8 22 01 00 00 00 00 ad de 4c 89 RSP: 0018:ffff88803ff1fab0 EFLAGS: 00010213 RAX: dffffc0000000000 RBX: 0457027d00003347 RCX: ffffffff83da1c83 RDX: 008ae04fa0000668 RSI: 0000000000000008 RDI: ffff88800dc0d008 RBP: ffff88803ebb6000 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: ffff88800dc0d000 R13: ffff88803ebb6260 R14: dffffc0000000000 R15: ffff88803e168000 FS: 00007f31d3d86700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007efc51741330 CR3: 00000000410e6000 CR4: 0000000000350ee0 Call Trace: hci_conn_del+0x29f/0x810 hci_conn_hash_flush+0x19d/0x240 hci_dev_close_sync+0x57f/0xff0 hci_rfkill_set_block+0x17b/0x1c0 rfkill_set_block+0x1fd/0x540 rfkill_fop_write+0x2b7/0x540 vfs_write+0x2d8/0xdd0 ksys_write+0x1f4/0x260 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7f31d6810b19 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f31d3d86188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f31d6923f60 RCX: 00007f31d6810b19 RDX: 0000000000000008 RSI: 0000000020000080 RDI: 0000000000000003 RBP: 00007f31d686af6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffecb7a72bf R14: 00007f31d3d86300 R15: 0000000000022000 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:hci_conn_cleanup+0x1c5/0x780 Code: fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 ef 04 00 00 48 89 da 49 89 5c 24 08 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 ab 04 00 00 48 b8 22 01 00 00 00 00 ad de 4c 89 RSP: 0018:ffff88803ff1fab0 EFLAGS: 00010213 RAX: dffffc0000000000 RBX: 0457027d00003347 RCX: ffffffff83da1c83 RDX: 008ae04fa0000668 RSI: 0000000000000008 RDI: ffff88800dc0d008 RBP: ffff88803ebb6000 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: ffff88800dc0d000 R13: ffff88803ebb6260 R14: dffffc0000000000 R15: ffff88803e168000 FS: 00007f31d3d86700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007efc51741330 CR3: 00000000410e6000 CR4: 0000000000350ee0 ---------------- Code disassembly (best guess), 2 bytes skipped: 0: df 48 89 fisttps -0x77(%rax) 3: fa cli 4: 48 c1 ea 03 shr $0x3,%rdx 8: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) c: 0f 85 ef 04 00 00 jne 0x501 12: 48 89 da mov %rbx,%rdx 15: 49 89 5c 24 08 mov %rbx,0x8(%r12) 1a: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 21: fc ff df 24: 48 c1 ea 03 shr $0x3,%rdx * 28: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction 2c: 0f 85 ab 04 00 00 jne 0x4dd 32: 48 b8 22 01 00 00 00 movabs $0xdead000000000122,%rax 39: 00 ad de 3c: 4c rex.WR 3d: 89 .byte 0x89