Bluetooth: hci0: Opcode 0x0c1a failed: -4 Bluetooth: hci0: Error when powering off device on rfkill (-4) ====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc4-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/2378 is trying to acquire lock: ffff888104ba88d0 ((work_completion)(&hdev->cmd_sync_work)){+.+.}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:329 [inline] ffff888104ba88d0 ((work_completion)(&hdev->cmd_sync_work)){+.+.}-{0:0}, at: rcu_read_lock include/linux/rcupdate.h:781 [inline] ffff888104ba88d0 ((work_completion)(&hdev->cmd_sync_work)){+.+.}-{0:0}, at: start_flush_work kernel/workqueue.c:4146 [inline] ffff888104ba88d0 ((work_completion)(&hdev->cmd_sync_work)){+.+.}-{0:0}, at: __flush_work+0x64/0x4e0 kernel/workqueue.c:4204 but task is already holding lock: ffff888104ba9060 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_do_close+0x1e/0x60 net/bluetooth/hci_core.c:559 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&hdev->req_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x99/0x9a0 kernel/locking/mutex.c:752 hci_cmd_sync_work+0xa9/0x190 net/bluetooth/hci_sync.c:309 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0x2a3/0x5b0 kernel/workqueue.c:3335 worker_thread+0x23e/0x300 kernel/workqueue.c:3416 kthread+0xea/0x100 kernel/kthread.c:388 ret_from_fork+0x32/0x40 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 -> #0 ((work_completion)(&hdev->cmd_sync_work)){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x11fe/0x2490 kernel/locking/lockdep.c:5137 lock_acquire+0xeb/0x270 kernel/locking/lockdep.c:5754 touch_work_lockdep_map kernel/workqueue.c:3916 [inline] start_flush_work kernel/workqueue.c:4172 [inline] __flush_work+0x393/0x4e0 kernel/workqueue.c:4204 __cancel_work_sync+0xfa/0x230 kernel/workqueue.c:4304 hci_cmd_sync_clear+0x1e/0xd0 net/bluetooth/hci_sync.c:588 hci_dev_close_sync+0x43f/0x630 net/bluetooth/hci_sync.c:5188 hci_dev_do_close+0x26/0x60 net/bluetooth/hci_core.c:561 hci_rfkill_set_block+0xd6/0x130 net/bluetooth/hci_core.c:992 rfkill_set_block+0x89/0x140 net/rfkill/core.c:346 rfkill_fop_write+0x190/0x1e0 net/rfkill/core.c:1305 do_loop_readv_writev fs/read_write.c:764 [inline] vfs_writev+0x2c7/0x3d0 fs/read_write.c:973 do_writev+0x70/0x110 fs/read_write.c:1018 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xa2/0x1b0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&hdev->req_lock); lock((work_completion)(&hdev->cmd_sync_work)); lock(&hdev->req_lock); lock((work_completion)(&hdev->cmd_sync_work)); *** DEADLOCK *** 3 locks held by syz-executor.0/2378: #0: ffffffff83d84ec0 (rfkill_global_mutex){+.+.}-{3:3}, at: rfkill_fop_write+0xad/0x1e0 net/rfkill/core.c:1297 #1: ffff888104ba9060 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_do_close+0x1e/0x60 net/bluetooth/hci_core.c:559 #2: ffffffff83b7ed10 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:329 [inline] #2: ffffffff83b7ed10 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:781 [inline] #2: ffffffff83b7ed10 (rcu_read_lock){....}-{1:2}, at: start_flush_work kernel/workqueue.c:4146 [inline] #2: ffffffff83b7ed10 (rcu_read_lock){....}-{1:2}, at: __flush_work+0x64/0x4e0 kernel/workqueue.c:4204 stack backtrace: CPU: 1 PID: 2378 Comm: syz-executor.0 Not tainted 6.9.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xa3/0x100 lib/dump_stack.c:114 check_noncircular+0x119/0x140 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x11fe/0x2490 kernel/locking/lockdep.c:5137 lock_acquire+0xeb/0x270 kernel/locking/lockdep.c:5754 touch_work_lockdep_map kernel/workqueue.c:3916 [inline] start_flush_work kernel/workqueue.c:4172 [inline] __flush_work+0x393/0x4e0 kernel/workqueue.c:4204 __cancel_work_sync+0xfa/0x230 kernel/workqueue.c:4304 hci_cmd_sync_clear+0x1e/0xd0 net/bluetooth/hci_sync.c:588 hci_dev_close_sync+0x43f/0x630 net/bluetooth/hci_sync.c:5188 hci_dev_do_close+0x26/0x60 net/bluetooth/hci_core.c:561 hci_rfkill_set_block+0xd6/0x130 net/bluetooth/hci_core.c:992 rfkill_set_block+0x89/0x140 net/rfkill/core.c:346 rfkill_fop_write+0x190/0x1e0 net/rfkill/core.c:1305 do_loop_readv_writev fs/read_write.c:764 [inline] vfs_writev+0x2c7/0x3d0 fs/read_write.c:973 do_writev+0x70/0x110 fs/read_write.c:1018 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xa2/0x1b0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f217a47dea9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f217b2100c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 00007f217a5abf80 RCX: 00007f217a47dea9 RDX: 0000000000000001 RSI: 00000000200000c0 RDI: 0000000000000003 RBP: 00007f217a4ca4a4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000006 R14: 00007f217a5abf80 R15: 00007ffc7e2d2ab8