====================================================== WARNING: possible circular locking dependency detected 6.1.69-syzkaller #0 Not tainted ------------------------------------------------------ kworker/0:4/4326 is trying to acquire lock: ffff0000d6c14dc0 ((work_completion)(&hdev->tx_work)){+.+.}-{0:0}, at: __flush_work+0xd0/0x1c0 kernel/workqueue.c:3072 but task is already holding lock: ffff0000d6c150b8 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_do_close net/bluetooth/hci_core.c:552 [inline] ffff0000d6c150b8 (&hdev->req_lock){+.+.}-{3:3}, at: hci_rfkill_set_block+0xe8/0x20c net/bluetooth/hci_core.c:956 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&hdev->req_lock){+.+.}-{3:3}: __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 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:345 rfkill_epo+0x8c/0x158 net/rfkill/core.c:454 __rfkill_handle_global_op net/rfkill/input.c:60 [inline] rfkill_op_handler+0x170/0x288 net/rfkill/input.c:108 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439 kthread+0x250/0x2d8 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864 -> #2 (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+0x38/0x44 kernel/locking/mutex.c:799 rfkill_register+0x44/0x7a4 net/rfkill/core.c:1057 hci_register_dev+0x3e0/0x954 net/bluetooth/hci_core.c:2655 __vhci_create_device drivers/bluetooth/hci_vhci.c:339 [inline] vhci_create_device+0x358/0x694 drivers/bluetooth/hci_vhci.c:377 vhci_get_user drivers/bluetooth/hci_vhci.c:434 [inline] vhci_write+0x318/0x3b8 drivers/bluetooth/hci_vhci.c:514 call_write_iter include/linux/fs.h:2248 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x610/0x914 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:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 -> #1 (&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+0x38/0x44 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:3035 hci_sched_acl_pkt net/bluetooth/hci_core.c:3642 [inline] hci_sched_acl net/bluetooth/hci_core.c:3727 [inline] hci_tx_work+0xba0/0x18e4 net/bluetooth/hci_core.c:3826 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439 kthread+0x250/0x2d8 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864 -> #0 ((work_completion)(&hdev->tx_work)){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain kernel/locking/lockdep.c:3825 [inline] __lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 __flush_work+0xf8/0x1c0 kernel/workqueue.c:3072 flush_work+0x24/0x38 kernel/workqueue.c:3097 hci_dev_close_sync+0x1c8/0xf1c net/bluetooth/hci_sync.c:4936 hci_dev_do_close net/bluetooth/hci_core.c:554 [inline] hci_rfkill_set_block+0xf0/0x20c net/bluetooth/hci_core.c:956 rfkill_set_block+0x18c/0x37c net/rfkill/core.c:345 rfkill_epo+0x8c/0x158 net/rfkill/core.c:454 __rfkill_handle_global_op net/rfkill/input.c:60 [inline] rfkill_op_handler+0x170/0x288 net/rfkill/input.c:108 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439 kthread+0x250/0x2d8 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864 other info that might help us debug this: Chain exists of: (work_completion)(&hdev->tx_work) --> rfkill_global_mutex --> &hdev->req_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&hdev->req_lock); lock(rfkill_global_mutex); lock(&hdev->req_lock); lock((work_completion)(&hdev->tx_work)); *** DEADLOCK *** 4 locks held by kworker/0:4/4326: #0: ffff0000c0020d38 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x664/0x1404 kernel/workqueue.c:2265 #1: ffff80001f747c20 ((rfkill_op_work).work){+.+.}-{0:0}, at: process_one_work+0x6a8/0x1404 kernel/workqueue.c:2267 #2: ffff80001809b188 (rfkill_global_mutex){+.+.}-{3:3}, at: rfkill_epo+0x58/0x158 net/rfkill/core.c:450 #3: ffff0000d6c150b8 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_do_close net/bluetooth/hci_core.c:552 [inline] #3: ffff0000d6c150b8 (&hdev->req_lock){+.+.}-{3:3}, at: hci_rfkill_set_block+0xe8/0x20c net/bluetooth/hci_core.c:956 stack backtrace: CPU: 0 PID: 4326 Comm: kworker/0:4 Not tainted 6.1.69-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023 Workqueue: events rfkill_op_handler Call trace: dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 dump_stack+0x1c/0x5c lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2048 check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2170 check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain kernel/locking/lockdep.c:3825 [inline] __lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 __flush_work+0xf8/0x1c0 kernel/workqueue.c:3072 flush_work+0x24/0x38 kernel/workqueue.c:3097 hci_dev_close_sync+0x1c8/0xf1c net/bluetooth/hci_sync.c:4936 hci_dev_do_close net/bluetooth/hci_core.c:554 [inline] hci_rfkill_set_block+0xf0/0x20c net/bluetooth/hci_core.c:956 rfkill_set_block+0x18c/0x37c net/rfkill/core.c:345 rfkill_epo+0x8c/0x158 net/rfkill/core.c:454 __rfkill_handle_global_op net/rfkill/input.c:60 [inline] rfkill_op_handler+0x170/0x288 net/rfkill/input.c:108 process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439 kthread+0x250/0x2d8 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864