================================================================== BUG: KASAN: use-after-free in atomic_dec_and_test include/asm-generic/atomic-instrumented.h:259 [inline] BUG: KASAN: use-after-free in hci_conn_drop include/net/bluetooth/hci_core.h:972 [inline] BUG: KASAN: use-after-free in sco_chan_del+0xe6/0x420 net/bluetooth/sco.c:148 Write of size 4 at addr ffff888089a201d0 by task syz-executor035/8564 CPU: 0 PID: 8564 Comm: syz-executor035 Not tainted 4.19.137-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+0x1fc/0x2fe lib/dump_stack.c:118 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256 kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354 kasan_report+0x8f/0x96 mm/kasan/report.c:412 atomic_dec_and_test include/asm-generic/atomic-instrumented.h:259 [inline] hci_conn_drop include/net/bluetooth/hci_core.h:972 [inline] sco_chan_del+0xe6/0x420 net/bluetooth/sco.c:148 __sco_sock_close+0xc3/0x720 net/bluetooth/sco.c:433 sco_sock_close net/bluetooth/sco.c:447 [inline] sco_sock_release+0x6b/0x3d0 net/bluetooth/sco.c:1008 __sock_release+0xcd/0x2a0 net/socket.c:579 sock_close+0x15/0x20 net/socket.c:1140 __fput+0x2ce/0x890 fs/file_table.c:278 task_work_run+0x148/0x1c0 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0xbb2/0x2b70 kernel/exit.c:887 do_group_exit+0x125/0x310 kernel/exit.c:990 get_signal+0x3f2/0x1f70 kernel/signal.c:2588 do_signal+0x8f/0x1670 arch/x86/kernel/signal.c:821 exit_to_usermode_loop+0x204/0x2a0 arch/x86/entry/common.c:163 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x446eb9 Code: Bad RIP value. RSP: 002b:00007fff575faa68 EFLAGS: 00000246 ORIG_RAX: 000000000000002a RAX: fffffffffffffffc RBX: 0000000000000000 RCX: 0000000000446eb9 RDX: 0000000000000008 RSI: 0000000020000540 RDI: 0000000000000004 RBP: 000000000000b2f8 R08: 0000000000000002 R09: 00000000000300ff R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000407b10 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 6650: kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] hci_conn_add+0x53/0x11e0 net/bluetooth/hci_conn.c:501 Bluetooth: hci0: command 0x0405 tx timeout hci_connect_sco+0x2fc/0x950 net/bluetooth/hci_conn.c:1238 sco_connect net/bluetooth/sco.c:240 [inline] sco_sock_connect+0x2ff/0x970 net/bluetooth/sco.c:576 __sys_connect+0x265/0x2c0 net/socket.c:1663 __do_sys_connect net/socket.c:1674 [inline] __se_sys_connect net/socket.c:1671 [inline] __x64_sys_connect+0x6f/0xb0 net/socket.c:1671 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 6640: __cache_free mm/slab.c:3503 [inline] kfree+0xcc/0x210 mm/slab.c:3822 device_release+0x76/0x210 drivers/base/core.c:1061 kobject_cleanup lib/kobject.c:662 [inline] kobject_release lib/kobject.c:691 [inline] kref_put include/linux/kref.h:70 [inline] kobject_put+0x22d/0x350 lib/kobject.c:708 put_device+0x1c/0x30 drivers/base/core.c:2251 hci_conn_del+0x27e/0x6a0 net/bluetooth/hci_conn.c:611 hci_phy_link_complete_evt.isra.0+0x5a4/0x7a0 net/bluetooth/hci_event.c:4680 hci_event_packet+0x1973/0x858f net/bluetooth/hci_event.c:5910 hci_rx_work+0x46b/0xa90 net/bluetooth/hci_core.c:4359 process_one_work+0x864/0x1570 kernel/workqueue.c:2155 worker_thread+0x64c/0x1130 kernel/workqueue.c:2298 kthread+0x30b/0x410 kernel/kthread.c:246 Bluetooth: hci5: command 0x0405 tx timeout ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 The buggy address belongs to the object at ffff888089a201c0 which belongs to the cache kmalloc-4096 of size 4096 The buggy address is located 16 bytes inside of 4096-byte region [ffff888089a201c0, ffff888089a211c0) The buggy address belongs to the page: page:ffffea0002268800 count:1 mapcount:0 mapping:ffff88812c39cdc0 index:0x0 compound_mapcount: 0 flags: 0xfffe0000008100(slab|head) raw: 00fffe0000008100 ffffea000292c888 ffffea00029f1c88 ffff88812c39cdc0 raw: 0000000000000000 ffff888089a201c0 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888089a20080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888089a20100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888089a20180: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff888089a20200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888089a20280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================