memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid=3901 'syz-executor.2'
======================================================
WARNING: possible circular locking dependency detected
6.2.0-next-20230224 #1 Not tainted
------------------------------------------------------
loop2: detected capacity change from 0 to 16383
syz-executor.4/276 is trying to acquire lock:
ffff88801625c880 ((work_completion)(&hdev->cmd_sync_work)){+.+.}-{0:0}, at: __flush_work+0xdd/0xd80
ext4: Unknown parameter 'fowner>00000000000000000000'

but task is already holding lock:
ffff88801625c920 (&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
       get_signal+0x23c8/0x2450
       arch_do_signal_or_restart+0x79/0x590
       exit_to_user_mode_prepare+0x122/0x190
       syscall_exit_to_user_mode+0x1d/0x50
       do_syscall_64+0x4c/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.4/276:
 #0: ffff88801625c920 (&hdev->cmd_sync_work_lock){+.+.}-{3:3}, at: hci_cmd_sync_clear+0x45/0x250

stack backtrace:
CPU: 1 PID: 276 Comm: syz-executor.4 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:
 <TASK>
 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
 get_signal+0x23c8/0x2450
 arch_do_signal_or_restart+0x79/0x590
 exit_to_user_mode_prepare+0x122/0x190
 syscall_exit_to_user_mode+0x1d/0x50
 do_syscall_64+0x4c/0x90
 entry_SYSCALL_64_after_hwframe+0x72/0xdc
RIP: 0033:0x7f867aed713a
Code: Unable to access opcode bytes at 0x7f867aed7110.
RSP: 002b:00007ffeff032d08 EFLAGS: 00000246 ORIG_RAX: 0000000000000037
RAX: fffffffffffffe00 RBX: 0000000000000029 RCX: 00007f867aed713a
RDX: 0000000000000040 RSI: 0000000000000029 RDI: 0000000000000003
RBP: 0000000000000003 R08: 00007ffeff032d3c R09: ffffffffffff0000
R10: 00007f867afb7228 R11: 0000000000000246 R12: 00007ffeff032d3c
R13: 00007f867af393b2 R14: 00007f867afb7228 R15: 00007f867afb7220
 </TASK>
wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50
wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50
IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
ieee80211 phy16: Selected rate control algorithm 'minstrel_ht'
loop2: detected capacity change from 0 to 16383
ext4: Unknown parameter 'fowner>00000000000000000000'
loop2: detected capacity change from 0 to 16383
ext4: Unknown parameter 'fowner>00000000000000000000'
loop2: detected capacity change from 0 to 16383
ext4: Unknown parameter 'fowner>00000000000000000000'
Bluetooth: hci2: unexpected cc 0x0c03 length: 249 > 1
Bluetooth: hci1: unexpected cc 0x0c03 length: 249 > 1
Bluetooth: hci4: unexpected cc 0x0c03 length: 249 > 1
Bluetooth: hci6: unexpected cc 0x0c03 length: 249 > 1
Bluetooth: hci2: unexpected cc 0x1003 length: 249 > 9
Bluetooth: hci4: unexpected cc 0x1003 length: 249 > 9
Bluetooth: hci6: unexpected cc 0x1003 length: 249 > 9
Bluetooth: hci1: unexpected cc 0x1003 length: 249 > 9
Bluetooth: hci6: unexpected cc 0x1001 length: 249 > 9
Bluetooth: hci2: unexpected cc 0x1001 length: 249 > 9
Bluetooth: hci4: unexpected cc 0x1001 length: 249 > 9
Bluetooth: hci1: unexpected cc 0x1001 length: 249 > 9
Bluetooth: hci2: unexpected cc 0x0c23 length: 249 > 4
Bluetooth: hci4: unexpected cc 0x0c23 length: 249 > 4
Bluetooth: hci1: unexpected cc 0x0c23 length: 249 > 4
Bluetooth: hci6: unexpected cc 0x0c23 length: 249 > 4
Bluetooth: hci2: unexpected cc 0x0c25 length: 249 > 3
Bluetooth: hci4: unexpected cc 0x0c25 length: 249 > 3
Bluetooth: hci6: unexpected cc 0x0c25 length: 249 > 3
Bluetooth: hci1: unexpected cc 0x0c25 length: 249 > 3
Bluetooth: hci2: unexpected cc 0x0c38 length: 249 > 2
Bluetooth: hci6: unexpected cc 0x0c38 length: 249 > 2
Bluetooth: hci4: unexpected cc 0x0c38 length: 249 > 2
Bluetooth: hci1: unexpected cc 0x0c38 length: 249 > 2
Bluetooth: hci7: unexpected cc 0x0c03 length: 249 > 1
Bluetooth: hci7: unexpected cc 0x1003 length: 249 > 9
Bluetooth: hci7: unexpected cc 0x1001 length: 249 > 9
Bluetooth: hci7: unexpected cc 0x0c23 length: 249 > 4
Bluetooth: hci7: unexpected cc 0x0c25 length: 249 > 3
Bluetooth: hci7: unexpected cc 0x0c38 length: 249 > 2
Bluetooth: hci0: Opcode 0x c03 failed: -110
Bluetooth: hci2: command 0x0409 tx timeout
Bluetooth: hci6: command 0x0409 tx timeout
Bluetooth: hci4: command 0x0409 tx timeout
Bluetooth: hci1: command 0x0409 tx timeout
Bluetooth: hci7: command 0x0409 tx timeout
Bluetooth: hci1: command 0x041b tx timeout
Bluetooth: hci4: command 0x041b tx timeout
Bluetooth: hci6: command 0x041b tx timeout
Bluetooth: hci2: command 0x041b tx timeout
Bluetooth: hci7: command 0x041b tx timeout
Bluetooth: hci0: unexpected cc 0x0c03 length: 249 > 1
Bluetooth: hci0: unexpected cc 0x1003 length: 249 > 9
Bluetooth: hci0: unexpected cc 0x1001 length: 249 > 9
Bluetooth: hci0: unexpected cc 0x0c23 length: 249 > 4
Bluetooth: hci0: unexpected cc 0x0c25 length: 249 > 3
Bluetooth: hci0: unexpected cc 0x0c38 length: 249 > 2
Bluetooth: hci2: command 0x040f tx timeout
Bluetooth: hci6: command 0x040f tx timeout
Bluetooth: hci4: command 0x040f tx timeout
Bluetooth: hci1: command 0x040f tx timeout
Bluetooth: hci7: command 0x040f tx timeout
Bluetooth: hci0: command 0x0409 tx timeout