R10: 000000000000007c R11: 0000000000000246 R12: 0000000000000001
R13: 00007fff4467c58f R14: 00007f8e5160d300 R15: 0000000000022000
======================================================
WARNING: possible circular locking dependency detected
6.2.0-next-20230224 #1 Not tainted
------------------------------------------------------
syz-executor.7/272 is trying to acquire lock:
ffff88800f148880 ((work_completion)(&hdev->cmd_sync_work)){+.+.}-{0:0}, at: __flush_work+0xdd/0xd80
but task is already holding lock:
ffff88800f148920 (&hdev->cmd_sync_work_lock){+.+.}-{3:3}, at: hci_cmd_sync_clear+0x45/0x250
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&hdev->cmd_sync_work_lock){+.+.}-{3:3}:
__mutex_lock+0x133/0x14a0
hci_cmd_sync_work+0x1e6/0x320
process_one_work+0xa0f/0x1790
worker_thread+0x63b/0x1260
kthread+0x2e9/0x3a0
ret_from_fork+0x2c/0x50
-> #0 ((work_completion)(&hdev->cmd_sync_work)){+.+.}-{0:0}:
__lock_acquire+0x2d56/0x6380
lock_acquire.part.0+0xea/0x320
__flush_work+0x109/0xd80
__cancel_work_timer+0x39c/0x4e0
hci_cmd_sync_clear+0x52/0x250
hci_unregister_dev+0xf9/0x410
vhci_release+0x80/0x100
__fput+0x263/0xa40
task_work_run+0x174/0x280
do_exit+0xad8/0x2800
do_group_exit+0xd4/0x2a0
__x64_sys_exit_group+0x3e/0x50
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x72/0xdc
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&hdev->cmd_sync_work_lock);
lock((work_completion)(&hdev->cmd_sync_work));
lock(&hdev->cmd_sync_work_lock);
lock((work_completion)(&hdev->cmd_sync_work));
*** DEADLOCK ***
1 lock held by syz-executor.7/272:
#0: ffff88800f148920 (&hdev->cmd_sync_work_lock){+.+.}-{3:3}, at: hci_cmd_sync_clear+0x45/0x250
stack backtrace:
CPU: 1 PID: 272 Comm: syz-executor.7 Not tainted 6.2.0-next-20230224 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
Call Trace:
dump_stack_lvl+0x91/0xf0
check_noncircular+0x263/0x2e0
__lock_acquire+0x2d56/0x6380
lock_acquire.part.0+0xea/0x320
__flush_work+0x109/0xd80
__cancel_work_timer+0x39c/0x4e0
hci_cmd_sync_clear+0x52/0x250
hci_unregister_dev+0xf9/0x410
vhci_release+0x80/0x100
__fput+0x263/0xa40
task_work_run+0x174/0x280
do_exit+0xad8/0x2800
do_group_exit+0xd4/0x2a0
__x64_sys_exit_group+0x3e/0x50
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x72/0xdc
RIP: 0033:0x7ff92b8ebb19
Code: Unable to access opcode bytes at 0x7ff92b8ebaef.
RSP: 002b:00007ffeb54d1878 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000064 RCX: 00007ff92b8ebb19
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 00007ff92b945177 R08: 000000000000000c R09: 00005555572483bc
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000016
R13: 00007ffeb54d2b50 R14: 00005555572483bc R15: 00007ffeb54d3c50
FAULT_INJECTION: forcing a failure.
name fail_usercopy, interval 1, probability 0, space 0, times 0
CPU: 1 PID: 4656 Comm: syz-executor.2 Not tainted 6.2.0-next-20230224 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
Call Trace:
dump_stack_lvl+0xc1/0xf0
should_fail_ex+0x4b4/0x5b0
_copy_to_user+0x2e/0x150
simple_read_from_buffer+0xd0/0x170
proc_fail_nth_read+0x19c/0x230
vfs_read+0x257/0x940
ksys_read+0x12b/0x260
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x72/0xdc
RIP: 0033:0x7f8e5404a69c
Code: ec 28 48 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 f9 fc ff ff 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 31 c0 0f 05 <48> 3d 00 f0 ff ff 77 34 44 89 c7 48 89 44 24 08 e8 2f fd ff ff 48
RSP: 002b:00007f8e5160d170 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000000000000062 RCX: 00007f8e5404a69c
RDX: 000000000000000f RSI: 00007f8e5160d1e0 RDI: 0000000000000004
RBP: 00007f8e5160d1d0 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000007c R11: 0000000000000246 R12: 0000000000000001
R13: 00007fff4467c58f R14: 00007f8e5160d300 R15: 0000000000022000