======================================================
WARNING: possible circular locking dependency detected
6.1.0-rc4-syzkaller-01125-g710cfc6ab4b8 #0 Not tainted
------------------------------------------------------
syz-executor.1/4082 is trying to acquire lock:
ffff888020a36350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_start_poll+0x59f/0xf20

but task is already holding lock:
ffff888020a31508 (&genl_data->genl_data_mutex){+.+.}-{3:3}, at: nfc_genl_start_poll+0x1da/0x350

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&genl_data->genl_data_mutex){+.+.}-{3:3}:
       lock_acquire+0x231/0x620
       __mutex_lock_common+0x1d4/0x2520
       mutex_lock_nested+0x17/0x20
       nfc_urelease_event_work+0x113/0x2f0
       process_one_work+0x8ee/0x1350
       worker_thread+0xa5f/0x1210
       kthread+0x268/0x300
       ret_from_fork+0x1f/0x30

-> #2 (nfc_devlist_mutex){+.+.}-{3:3}:
       lock_acquire+0x231/0x620
       __mutex_lock_common+0x1d4/0x2520
       mutex_lock_nested+0x17/0x20
       nfc_register_device+0x38/0x310
       nci_register_device+0x7be/0x900
       virtual_ncidev_open+0x55/0xc0
       misc_open+0x304/0x380
       chrdev_open+0x54a/0x630
       do_dentry_open+0x7f9/0x10f0
       path_openat+0x263f/0x2e60
       do_filp_open+0x230/0x480
       do_sys_openat2+0x13b/0x500
       __x64_sys_openat+0x243/0x290
       do_syscall_64+0x3d/0xb0
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #1 (nci_mutex){+.+.}-{3:3}:
       lock_acquire+0x231/0x620
       __mutex_lock_common+0x1d4/0x2520
       mutex_lock_nested+0x17/0x20
       virtual_nci_close+0x13/0x40
       nci_dev_up+0x954/0xd40
       nfc_dev_up+0x185/0x330
       nfc_genl_dev_up+0x80/0xd0
       genl_rcv_msg+0xc2f/0xf90
       netlink_rcv_skb+0x1db/0x420
       genl_rcv+0x24/0x40
       netlink_unicast+0x7bf/0x990
       netlink_sendmsg+0x9fe/0xd10
       ____sys_sendmsg+0x59e/0x8f0
       __sys_sendmsg+0x2a9/0x390
       do_syscall_64+0x3d/0xb0
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (&ndev->req_lock){+.+.}-{3:3}:
       validate_chain+0x1667/0x58e0
       __lock_acquire+0x125b/0x1f80
       lock_acquire+0x231/0x620
       __mutex_lock_common+0x1d4/0x2520
       mutex_lock_nested+0x17/0x20
       nci_start_poll+0x59f/0xf20
       nfc_start_poll+0x184/0x2f0
       nfc_genl_start_poll+0x1e7/0x350
       genl_rcv_msg+0xc2f/0xf90
       netlink_rcv_skb+0x1db/0x420
       genl_rcv+0x24/0x40
       netlink_unicast+0x7bf/0x990
       netlink_sendmsg+0x9fe/0xd10
       ____sys_sendmsg+0x59e/0x8f0
       __sys_sendmsg+0x2a9/0x390
       do_syscall_64+0x3d/0xb0
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

Chain exists of:
  &ndev->req_lock --> nfc_devlist_mutex --> &genl_data->genl_data_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&genl_data->genl_data_mutex);
                               lock(nfc_devlist_mutex);
                               lock(&genl_data->genl_data_mutex);
  lock(&ndev->req_lock);

 *** DEADLOCK ***

4 locks held by syz-executor.1/4082:
 #0: ffffffff8da3f9d0 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40
 #1: ffffffff8da3f888 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg+0x12c/0xf90
 #2: ffff888020a31508 (&genl_data->genl_data_mutex){+.+.}-{3:3}, at: nfc_genl_start_poll+0x1da/0x350
 #3: ffff888020a31100 (&dev->mutex){....}-{3:3}, at: nfc_start_poll+0x56/0x2f0

stack backtrace:
CPU: 0 PID: 4082 Comm: syz-executor.1 Not tainted 6.1.0-rc4-syzkaller-01125-g710cfc6ab4b8 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 dump_stack_lvl+0x1e3/0x2cb
 check_noncircular+0x2fa/0x3b0
 validate_chain+0x1667/0x58e0
 __lock_acquire+0x125b/0x1f80
 lock_acquire+0x231/0x620
 __mutex_lock_common+0x1d4/0x2520
 mutex_lock_nested+0x17/0x20
 nci_start_poll+0x59f/0xf20
 nfc_start_poll+0x184/0x2f0
 nfc_genl_start_poll+0x1e7/0x350
 genl_rcv_msg+0xc2f/0xf90
 netlink_rcv_skb+0x1db/0x420
 genl_rcv+0x24/0x40
 netlink_unicast+0x7bf/0x990
 netlink_sendmsg+0x9fe/0xd10
 ____sys_sendmsg+0x59e/0x8f0
 __sys_sendmsg+0x2a9/0x390
 do_syscall_64+0x3d/0xb0
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fae23a7be39
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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fae248640c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fae23b9c050 RCX: 00007fae23a7be39
RDX: 0000000000000000 RSI: 0000000020000440 RDI: 0000000000000005
RBP: 00007fae23ad8ad0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000006e R14: 00007fae23b9c050 R15: 00007ffeb3fd6688
 </TASK>
nci: __nci_request: wait_for_completion_interruptible_timeout failed -512
nci: nci_start_poll: failed to set local general bytes
