Bluetooth: hci0: Opcode 0x0c1a failed: -4 Bluetooth: hci0: Error when powering off device on rfkill (-4) ============================================ WARNING: possible recursive locking detected 6.12.0-rc4-syzkaller-00047-gc2ee9f594da8 #0 Not tainted -------------------------------------------- syz.3.1738/13582 is trying to acquire lock: ffff888056d1c078 (&hdev->lock){+.+.}-{3:3}, at: mgmt_remove_adv_monitor_complete+0xaf/0x550 net/bluetooth/mgmt.c:5454 but task is already holding lock: ffff888056d1c078 (&hdev->lock){+.+.}-{3:3}, at: hci_dev_close_sync+0x572/0x11a0 net/bluetooth/hci_sync.c:5183 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&hdev->lock); lock(&hdev->lock); *** DEADLOCK *** May be due to missing lock nesting notation 4 locks held by syz.3.1738/13582: #0: ffffffff8ff97da8 (rfkill_global_mutex){+.+.}-{3:3}, at: rfkill_fop_write+0x1a6/0x790 net/rfkill/core.c:1293 #1: ffff888056d1cd80 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_do_close+0x28/0x90 net/bluetooth/hci_core.c:481 #2: ffff888056d1c078 (&hdev->lock){+.+.}-{3:3}, at: hci_dev_close_sync+0x572/0x11a0 net/bluetooth/hci_sync.c:5183 #3: ffff888056d1c690 (&hdev->cmd_sync_work_lock){+.+.}-{3:3}, at: hci_cmd_sync_dequeue+0x44/0x3d0 net/bluetooth/hci_sync.c:883 stack backtrace: CPU: 1 UID: 0 PID: 13582 Comm: syz.3.1738 Not tainted 6.12.0-rc4-syzkaller-00047-gc2ee9f594da8 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_deadlock_bug+0x483/0x620 kernel/locking/lockdep.c:3037 check_deadlock kernel/locking/lockdep.c:3089 [inline] validate_chain+0x15e2/0x5920 kernel/locking/lockdep.c:3891 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 mgmt_remove_adv_monitor_complete+0xaf/0x550 net/bluetooth/mgmt.c:5454 _hci_cmd_sync_cancel_entry net/bluetooth/hci_sync.c:641 [inline] hci_cmd_sync_dequeue+0x22b/0x3d0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x4c/0x180 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xd1/0x130 net/bluetooth/mgmt_util.c:259 __mgmt_power_off+0x183/0x430 net/bluetooth/mgmt.c:9474 hci_dev_close_sync+0x665/0x11a0 net/bluetooth/hci_sync.c:5191 hci_dev_do_close+0x30/0x90 net/bluetooth/hci_core.c:483 hci_rfkill_set_block+0x232/0x300 net/bluetooth/hci_core.c:911 rfkill_set_block+0x1f1/0x440 net/rfkill/core.c:346 rfkill_fop_write+0x5b8/0x790 net/rfkill/core.c:1301 do_loop_readv_writev fs/read_write.c:857 [inline] vfs_writev+0x5a9/0xba0 fs/read_write.c:1066 do_writev+0x1b1/0x350 fs/read_write.c:1111 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f394cd7e719 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f394c7ff038 EFLAGS: 00000246 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 00007f394cf36130 RCX: 00007f394cd7e719 RDX: 0000000000000001 RSI: 0000000020000140 RDI: 0000000000000009 RBP: 00007f394cdf12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f394cf36130 R15: 00007ffe24784e68