====================================================== WARNING: possible circular locking dependency detected 5.15.153-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/7429 is trying to acquire lock: ffff88807ea62350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_request net/nfc/nci/core.c:148 [inline] ffff88807ea62350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_set_local_general_bytes net/nfc/nci/core.c:774 [inline] ffff88807ea62350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_start_poll+0x59f/0xf20 net/nfc/nci/core.c:838 but task is already holding lock: ffff88807e4b65d0 (&genl_data->genl_data_mutex){+.+.}-{3:3}, at: nfc_genl_start_poll+0x1da/0x350 net/nfc/netlink.c:826 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+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 nfc_urelease_event_work+0x113/0x2f0 net/nfc/netlink.c:1833 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457 kthread+0x3f6/0x4f0 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 -> #2 (nfc_devlist_mutex){+.+.}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 nfc_register_device+0x38/0x310 net/nfc/core.c:1116 nci_register_device+0x7be/0x900 net/nfc/nci/core.c:1269 virtual_ncidev_open+0x55/0xc0 drivers/nfc/virtual_ncidev.c:146 misc_open+0x304/0x380 drivers/char/misc.c:141 chrdev_open+0x54a/0x630 fs/char_dev.c:414 do_dentry_open+0x807/0xfb0 fs/open.c:826 do_open fs/namei.c:3608 [inline] path_openat+0x2702/0x2f20 fs/namei.c:3742 do_filp_open+0x21c/0x460 fs/namei.c:3769 do_sys_openat2+0x13b/0x500 fs/open.c:1211 do_sys_open fs/open.c:1227 [inline] __do_sys_openat fs/open.c:1243 [inline] __se_sys_openat fs/open.c:1238 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1238 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb -> #1 (nci_mutex){+.+.}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 virtual_nci_close+0x13/0x40 drivers/nfc/virtual_ncidev.c:44 nci_open_device net/nfc/nci/core.c:544 [inline] nci_dev_up+0x954/0xd40 net/nfc/nci/core.c:631 nfc_dev_up+0x185/0x330 net/nfc/core.c:118 nfc_genl_dev_up+0x80/0xd0 net/nfc/netlink.c:770 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline] genl_family_rcv_msg net/netlink/genetlink.c:775 [inline] genl_rcv_msg+0xfbd/0x14a0 net/netlink/genetlink.c:792 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2485 __sys_sendmsg net/socket.c:2514 [inline] __do_sys_sendmsg net/socket.c:2523 [inline] __se_sys_sendmsg+0x19a/0x260 net/socket.c:2521 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb -> #0 (&ndev->req_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 nci_request net/nfc/nci/core.c:148 [inline] nci_set_local_general_bytes net/nfc/nci/core.c:774 [inline] nci_start_poll+0x59f/0xf20 net/nfc/nci/core.c:838 nfc_start_poll+0x184/0x2f0 net/nfc/core.c:225 nfc_genl_start_poll+0x1e7/0x350 net/nfc/netlink.c:828 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline] genl_family_rcv_msg net/netlink/genetlink.c:775 [inline] genl_rcv_msg+0xfbd/0x14a0 net/netlink/genetlink.c:792 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2485 __sys_sendmsg net/socket.c:2514 [inline] __do_sys_sendmsg net/socket.c:2523 [inline] __se_sys_sendmsg+0x19a/0x260 net/socket.c:2521 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb 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.0/7429: #0: ffffffff8da39830 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40 net/netlink/genetlink.c:802 #1: ffffffff8da396e8 (genl_mutex){+.+.}-{3:3}, at: genl_lock net/netlink/genetlink.c:33 [inline] #1: ffffffff8da396e8 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg+0x124/0x14a0 net/netlink/genetlink.c:790 #2: ffff88807e4b65d0 (&genl_data->genl_data_mutex){+.+.}-{3:3}, at: nfc_genl_start_poll+0x1da/0x350 net/nfc/netlink.c:826 #3: ffff88807e4b6190 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:760 [inline] #3: ffff88807e4b6190 (&dev->mutex){....}-{3:3}, at: nfc_start_poll+0x56/0x2f0 net/nfc/core.c:208 stack backtrace: CPU: 1 PID: 7429 Comm: syz-executor.0 Not tainted 5.15.153-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 nci_request net/nfc/nci/core.c:148 [inline] nci_set_local_general_bytes net/nfc/nci/core.c:774 [inline] nci_start_poll+0x59f/0xf20 net/nfc/nci/core.c:838 nfc_start_poll+0x184/0x2f0 net/nfc/core.c:225 nfc_genl_start_poll+0x1e7/0x350 net/nfc/netlink.c:828 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline] genl_family_rcv_msg net/netlink/genetlink.c:775 [inline] genl_rcv_msg+0xfbd/0x14a0 net/netlink/genetlink.c:792 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2485 __sys_sendmsg net/socket.c:2514 [inline] __do_sys_sendmsg net/socket.c:2523 [inline] __se_sys_sendmsg+0x19a/0x260 net/socket.c:2521 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7fc121bbbe69 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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:00007fc12010d0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007fc121cea050 RCX: 00007fc121bbbe69 RDX: 0000000000000000 RSI: 0000000020000440 RDI: 0000000000000005 RBP: 00007fc121c0847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007fc121cea050 R15: 00007fff3a41e808