====================================================== WARNING: possible circular locking dependency detected 6.0.0-next-20221014 #1 Not tainted ------------------------------------------------------ syz-executor.5/22374 is trying to acquire lock: ffff8880174ec070 ((work_completion)(&(&conn->timeout_work)->work)){+.+.}-{0:0}, at: __flush_work+0xdd/0xd00 but task is already holding lock: ffffffff859dfee8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_conn_hash_flush+0xc7/0x230 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (hci_cb_list_lock){+.+.}-{3:3}: __mutex_lock+0x136/0x14d0 hci_remote_features_evt+0x47a/0x990 hci_event_packet+0x919/0xf60 hci_rx_work+0xa82/0x1000 process_one_work+0xa17/0x16a0 worker_thread+0x637/0x1260 kthread+0x2ed/0x3a0 ret_from_fork+0x22/0x30 -> #2 (&hdev->lock){+.+.}-{3:3}: __mutex_lock+0x136/0x14d0 sco_sock_connect+0x1e4/0xa60 __sys_connect_file+0x155/0x1a0 __sys_connect+0x165/0x1a0 __x64_sys_connect+0x6f/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}: lock_sock_nested+0x3d/0xf0 sco_sock_timeout+0xc3/0x230 process_one_work+0xa17/0x16a0 worker_thread+0x637/0x1260 kthread+0x2ed/0x3a0 ret_from_fork+0x22/0x30 -> #0 ((work_completion)(&(&conn->timeout_work)->work)){+.+.}-{0:0}: __lock_acquire+0x2a02/0x5e70 lock_acquire+0x1a2/0x530 __flush_work+0x105/0xd00 __cancel_work_timer+0x39c/0x4e0 sco_conn_del+0x1e4/0x2c0 sco_disconn_cfm+0x62/0x80 hci_conn_hash_flush+0x119/0x230 hci_dev_close_sync+0x57b/0xfe0 hci_unregister_dev+0x10f/0x380 vhci_release+0x7c/0xf0 __fput+0x263/0xa40 task_work_run+0x170/0x280 do_exit+0xb21/0x27f0 do_group_exit+0xd0/0x2a0 __x64_sys_exit_group+0x3a/0x50 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Chain exists of: (work_completion)(&(&conn->timeout_work)->work) --> &hdev->lock --> hci_cb_list_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(hci_cb_list_lock); lock(&hdev->lock); lock(hci_cb_list_lock); lock((work_completion)(&(&conn->timeout_work)->work)); *** DEADLOCK *** 3 locks held by syz-executor.5/22374: #0: ffff888044131028 (&hdev->req_lock){+.+.}-{3:3}, at: hci_unregister_dev+0x107/0x380 #1: ffff888044130078 (&hdev->lock){+.+.}-{3:3}, at: hci_dev_close_sync+0x2e0/0xfe0 #2: ffffffff859dfee8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_conn_hash_flush+0xc7/0x230 stack backtrace: CPU: 0 PID: 22374 Comm: syz-executor.5 Not tainted 6.0.0-next-20221014 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x8b/0xb3 check_noncircular+0x263/0x2e0 __lock_acquire+0x2a02/0x5e70 lock_acquire+0x1a2/0x530 __flush_work+0x105/0xd00 __cancel_work_timer+0x39c/0x4e0 sco_conn_del+0x1e4/0x2c0 sco_disconn_cfm+0x62/0x80 hci_conn_hash_flush+0x119/0x230 hci_dev_close_sync+0x57b/0xfe0 hci_unregister_dev+0x10f/0x380 vhci_release+0x7c/0xf0 __fput+0x263/0xa40 task_work_run+0x170/0x280 do_exit+0xb21/0x27f0 do_group_exit+0xd0/0x2a0 __x64_sys_exit_group+0x3a/0x50 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fd3a5eabb19 Code: Unable to access opcode bytes at 0x7fd3a5eabaef. RSP: 002b:00007ffc4fbf61d8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00000000000000ae RCX: 00007fd3a5eabb19 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000043 RBP: 0000000000000000 R08: 0000000000000014 R09: 00000000000000ae R10: 0000000000000000 R11: 0000000000000246 R12: 00007fd3a5f060c3 R13: 0000000000000000 R14: 0000000000000003 R15: 00007ffc4fbf63c0 Bluetooth: hci6: unexpected cc 0x0c03 length: 249 > 1 Bluetooth: hci6: unexpected cc 0x1003 length: 249 > 9 Bluetooth: hci6: unexpected cc 0x1001 length: 249 > 9 Bluetooth: hci6: unexpected cc 0x0c23 length: 249 > 4 Bluetooth: hci6: unexpected cc 0x0c25 length: 249 > 3 Bluetooth: hci6: unexpected cc 0x0c38 length: 249 > 2 Bluetooth: hci6: HCI_REQ-0x0c1a Bluetooth: hci6: command 0x0409 tx timeout Bluetooth: hci6: command 0x041b tx timeout Bluetooth: hci6: command 0x040f tx timeout