====================================================== WARNING: possible circular locking dependency detected 6.6.0-rc7-syzkaller-00151-g56567a20b22b #0 Not tainted ------------------------------------------------------ kworker/1:2/5082 is trying to acquire lock: ffff0000c62650b8 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_do_close net/bluetooth/hci_core.c:552 [inline] ffff0000c62650b8 (&hdev->req_lock){+.+.}-{3:3}, at: hci_rfkill_set_block+0xe8/0x20c net/bluetooth/hci_core.c:956 but task is already holding lock: ffff80008f73e988 (rfkill_global_mutex){+.+.}-{3:3}, at: rfkill_epo+0x58/0x158 net/rfkill/core.c:462 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (rfkill_global_mutex){+.+.}-{3:3}: __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:799 rfkill_register+0x44/0x7d4 net/rfkill/core.c:1075 hci_register_dev+0x3e0/0x954 net/bluetooth/hci_core.c:2656 __vhci_create_device drivers/bluetooth/hci_vhci.c:437 [inline] vhci_create_device+0x358/0x6c4 drivers/bluetooth/hci_vhci.c:478 vhci_get_user drivers/bluetooth/hci_vhci.c:535 [inline] vhci_write+0x318/0x3b8 drivers/bluetooth/hci_vhci.c:615 call_write_iter include/linux/fs.h:1956 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x628/0x93c fs/read_write.c:584 ksys_write+0x15c/0x26c fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:646 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x58/0x16c arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595 -> #2 (&data->open_mutex){+.+.}-{3:3}: __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:799 vhci_send_frame+0x8c/0x10c drivers/bluetooth/hci_vhci.c:78 hci_send_frame+0x1c4/0x35c net/bluetooth/hci_core.c:3039 hci_sched_acl_pkt net/bluetooth/hci_core.c:3651 [inline] hci_sched_acl net/bluetooth/hci_core.c:3736 [inline] hci_tx_work+0xba0/0x18e4 net/bluetooth/hci_core.c:3835 process_one_work+0x694/0x1204 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:2784 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:857 -> #1 ((work_completion)(&hdev->tx_work)){+.+.}-{0:0}: __flush_work+0xf8/0x1c0 kernel/workqueue.c:3403 flush_work+0x24/0x38 kernel/workqueue.c:3428 hci_dev_close_sync+0x1c8/0xf2c net/bluetooth/hci_sync.c:4982 hci_dev_do_close net/bluetooth/hci_core.c:554 [inline] hci_unregister_dev+0x1e8/0x4ac net/bluetooth/hci_core.c:2737 vhci_release+0x7c/0xd0 drivers/bluetooth/hci_vhci.c:672 __fput+0x324/0x7f8 fs/file_table.c:384 ____fput+0x20/0x30 fs/file_table.c:412 task_work_run+0x230/0x2e0 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x63c/0x1f58 kernel/exit.c:874 do_group_exit+0x194/0x22c kernel/exit.c:1024 get_signal+0x1500/0x15ec kernel/signal.c:2892 do_signal arch/arm64/kernel/signal.c:1249 [inline] do_notify_resume+0x3cc/0x3c94 arch/arm64/kernel/signal.c:1302 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:137 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:144 [inline] el0_svc+0xa0/0x16c arch/arm64/kernel/entry-common.c:679 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595 -> #0 (&hdev->req_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3868 [inline] __lock_acquire+0x3370/0x75e8 kernel/locking/lockdep.c:5136 lock_acquire+0x23c/0x71c kernel/locking/lockdep.c:5753 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:799 hci_dev_do_close net/bluetooth/hci_core.c:552 [inline] hci_rfkill_set_block+0xe8/0x20c net/bluetooth/hci_core.c:956 rfkill_set_block+0x18c/0x37c net/rfkill/core.c:346 rfkill_epo+0x8c/0x158 net/rfkill/core.c:466 __rfkill_handle_global_op net/rfkill/input.c:60 [inline] rfkill_op_handler+0x170/0x288 net/rfkill/input.c:108 process_one_work+0x694/0x1204 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:2784 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:857 other info that might help us debug this: Chain exists of: &hdev->req_lock --> &data->open_mutex --> rfkill_global_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(rfkill_global_mutex); lock(&data->open_mutex); lock(rfkill_global_mutex); lock(&hdev->req_lock); *** DEADLOCK *** 3 locks held by kworker/1:2/5082: #0: ffff0000c0020d38 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x560/0x1204 kernel/workqueue.c:2603 #1: ffff80009a937c20 ((rfkill_op_work).work){+.+.}-{0:0}, at: process_one_work+0x5a0/0x1204 kernel/workqueue.c:2605 #2: ffff80008f73e988 (rfkill_global_mutex){+.+.}-{3:3}, at: rfkill_epo+0x58/0x158 net/rfkill/core.c:462 stack backtrace: CPU: 1 PID: 5082 Comm: kworker/1:2 Not tainted 6.6.0-rc7-syzkaller-00151-g56567a20b22b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023 Workqueue: events rfkill_op_handler Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:233 show_stack+0x2c/0x44 arch/arm64/kernel/stacktrace.c:240 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 dump_stack+0x1c/0x28 lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2060 check_noncircular+0x310/0x404 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:3868 [inline] __lock_acquire+0x3370/0x75e8 kernel/locking/lockdep.c:5136 lock_acquire+0x23c/0x71c kernel/locking/lockdep.c:5753 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:799 hci_dev_do_close net/bluetooth/hci_core.c:552 [inline] hci_rfkill_set_block+0xe8/0x20c net/bluetooth/hci_core.c:956 rfkill_set_block+0x18c/0x37c net/rfkill/core.c:346 rfkill_epo+0x8c/0x158 net/rfkill/core.c:466 __rfkill_handle_global_op net/rfkill/input.c:60 [inline] rfkill_op_handler+0x170/0x288 net/rfkill/input.c:108 process_one_work+0x694/0x1204 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:2784 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:857