====================================================== WARNING: possible circular locking dependency detected 6.1.0-syzkaller-03225-g764822972d64 #0 Not tainted ------------------------------------------------------ syz-executor.3/12078 is trying to acquire lock: ffff888077ee5670 ((work_completion)(&(&conn->timeout_work)->work)){+.+.}-{0:0}, at: __flush_work+0xdd/0xaf0 kernel/workqueue.c:3066 but task is already holding lock: ffffffff8e0d93c8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_disconn_cfm include/net/bluetooth/hci_core.h:1784 [inline] ffffffff8e0d93c8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_conn_hash_flush+0xd9/0x260 net/bluetooth/hci_conn.c:2436 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_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 hci_connect_cfm include/net/bluetooth/hci_core.h:1769 [inline] hci_remote_features_evt+0x49e/0xa20 net/bluetooth/hci_event.c:3758 hci_event_func net/bluetooth/hci_event.c:7472 [inline] hci_event_packet+0x956/0xfd0 net/bluetooth/hci_event.c:7524 hci_rx_work+0xaeb/0x1230 net/bluetooth/hci_core.c:4043 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 -> #2 (&hdev->lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 sco_sock_connect+0x1ea/0xa60 net/bluetooth/sco.c:593 __sys_connect_file+0x153/0x1a0 net/socket.c:1976 __sys_connect+0x165/0x1a0 net/socket.c:1993 __do_sys_connect net/socket.c:2003 [inline] __se_sys_connect net/socket.c:2000 [inline] __x64_sys_connect+0x73/0xb0 net/socket.c:2000 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}: lock_sock_nested+0x3a/0xf0 net/core/sock.c:3447 lock_sock include/net/sock.h:1721 [inline] sco_sock_timeout+0xd1/0x290 net/bluetooth/sco.c:97 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 -> #0 ((work_completion)(&(&conn->timeout_work)->work)){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633 __flush_work+0x109/0xaf0 kernel/workqueue.c:3069 __cancel_work_timer+0x3f9/0x570 kernel/workqueue.c:3160 sco_conn_del+0x1b5/0x2b0 net/bluetooth/sco.c:205 sco_disconn_cfm+0x75/0xb0 net/bluetooth/sco.c:1379 hci_disconn_cfm include/net/bluetooth/hci_core.h:1787 [inline] hci_conn_hash_flush+0x126/0x260 net/bluetooth/hci_conn.c:2436 hci_dev_close_sync+0x5fb/0x1200 net/bluetooth/hci_sync.c:4831 hci_dev_do_close+0x31/0x70 net/bluetooth/hci_core.c:554 hci_rfkill_set_block+0x161/0x1d0 net/bluetooth/hci_core.c:956 rfkill_set_block+0x1f9/0x540 net/rfkill/core.c:345 rfkill_fop_write+0x2c7/0x570 net/rfkill/core.c:1286 vfs_write+0x2db/0xdd0 fs/read_write.c:582 ksys_write+0x1ec/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 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 *** 4 locks held by syz-executor.3/12078: #0: ffffffff8e2ceb68 (rfkill_global_mutex){+.+.}-{3:3}, at: rfkill_fop_write+0x160/0x570 net/rfkill/core.c:1278 #1: ffff88807db21028 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_do_close+0x29/0x70 net/bluetooth/hci_core.c:552 #2: ffff88807db20078 (&hdev->lock){+.+.}-{3:3}, at: hci_dev_close_sync+0x306/0x1200 net/bluetooth/hci_sync.c:4818 #3: ffffffff8e0d93c8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_disconn_cfm include/net/bluetooth/hci_core.h:1784 [inline] #3: ffffffff8e0d93c8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_conn_hash_flush+0xd9/0x260 net/bluetooth/hci_conn.c:2436 stack backtrace: CPU: 0 PID: 12078 Comm: syz-executor.3 Not tainted 6.1.0-syzkaller-03225-g764822972d64 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2177 check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633 __flush_work+0x109/0xaf0 kernel/workqueue.c:3069 __cancel_work_timer+0x3f9/0x570 kernel/workqueue.c:3160 sco_conn_del+0x1b5/0x2b0 net/bluetooth/sco.c:205 sco_disconn_cfm+0x75/0xb0 net/bluetooth/sco.c:1379 hci_disconn_cfm include/net/bluetooth/hci_core.h:1787 [inline] hci_conn_hash_flush+0x126/0x260 net/bluetooth/hci_conn.c:2436 hci_dev_close_sync+0x5fb/0x1200 net/bluetooth/hci_sync.c:4831 hci_dev_do_close+0x31/0x70 net/bluetooth/hci_core.c:554 hci_rfkill_set_block+0x161/0x1d0 net/bluetooth/hci_core.c:956 rfkill_set_block+0x1f9/0x540 net/rfkill/core.c:345 rfkill_fop_write+0x2c7/0x570 net/rfkill/core.c:1286 vfs_write+0x2db/0xdd0 fs/read_write.c:582 ksys_write+0x1ec/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f892c28c0d9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f892d08e168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f892c3abf80 RCX: 00007f892c28c0d9 RDX: 0000000000000008 RSI: 0000000020000040 RDI: 0000000000000003 RBP: 00007f892c2e7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc622a908f R14: 00007f892d08e300 R15: 0000000000022000