====================================================== WARNING: possible circular locking dependency detected 5.15.112-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor364/3976 is trying to acquire lock: ffff0000d947f350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_request net/nfc/nci/core.c:148 [inline] ffff0000d947f350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_set_local_general_bytes net/nfc/nci/core.c:774 [inline] ffff0000d947f350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_start_poll+0x498/0x1204 net/nfc/nci/core.c:838 but task is already holding lock: ffff0000c8f285e8 (&genl_data->genl_data_mutex){+.+.}-{3:3}, at: nfc_genl_start_poll+0x1a8/0x308 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}: __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 nfc_urelease_event_work+0xfc/0x2a8 net/nfc/netlink.c:1823 process_one_work+0x790/0x11b8 kernel/workqueue.c:2307 worker_thread+0x910/0x1034 kernel/workqueue.c:2454 kthread+0x37c/0x45c kernel/kthread.c:319 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870 -> #2 (nfc_devlist_mutex){+.+.}-{3:3}: __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 nfc_register_device+0x4c/0x310 net/nfc/core.c:1116 nci_register_device+0x6ac/0x7c4 net/nfc/nci/core.c:1260 virtual_ncidev_open+0x6c/0xd8 drivers/nfc/virtual_ncidev.c:146 misc_open+0x2f0/0x368 drivers/char/misc.c:141 chrdev_open+0x3e8/0x4fc fs/char_dev.c:414 do_dentry_open+0x780/0xed8 fs/open.c:826 vfs_open+0x7c/0x90 fs/open.c:956 do_open fs/namei.c:3538 [inline] path_openat+0x1f28/0x26f0 fs/namei.c:3672 do_filp_open+0x1a8/0x3b4 fs/namei.c:3699 do_sys_openat2+0x128/0x3d8 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] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1238 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #1 (nci_mutex){+.+.}-{3:3}: __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 virtual_nci_close+0x28/0x58 drivers/nfc/virtual_ncidev.c:44 nci_open_device net/nfc/nci/core.c:544 [inline] nci_dev_up+0x760/0xb50 net/nfc/nci/core.c:631 nfc_dev_up+0x154/0x300 net/nfc/core.c:118 nfc_genl_dev_up+0x98/0xdc 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+0xc18/0x1018 net/netlink/genetlink.c:792 netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2504 genl_rcv+0x38/0x50 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x664/0x938 net/netlink/af_netlink.c:1356 netlink_sendmsg+0x844/0xb38 net/netlink/af_netlink.c:1923 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x584/0x870 net/socket.c:2412 ___sys_sendmsg+0x214/0x294 net/socket.c:2466 __sys_sendmsg net/socket.c:2495 [inline] __do_sys_sendmsg net/socket.c:2504 [inline] __se_sys_sendmsg net/socket.c:2502 [inline] __arm64_sys_sendmsg+0x1ac/0x25c net/socket.c:2502 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #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 kernel/locking/lockdep.c:3787 [inline] __lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622 __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 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+0x498/0x1204 net/nfc/nci/core.c:838 nfc_start_poll+0x164/0x2a4 net/nfc/core.c:225 nfc_genl_start_poll+0x1b8/0x308 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+0xc18/0x1018 net/netlink/genetlink.c:792 netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2504 genl_rcv+0x38/0x50 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x664/0x938 net/netlink/af_netlink.c:1356 netlink_sendmsg+0x844/0xb38 net/netlink/af_netlink.c:1923 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x584/0x870 net/socket.c:2412 ___sys_sendmsg+0x214/0x294 net/socket.c:2466 __sys_sendmsg net/socket.c:2495 [inline] __do_sys_sendmsg net/socket.c:2504 [inline] __se_sys_sendmsg net/socket.c:2502 [inline] __arm64_sys_sendmsg+0x1ac/0x25c net/socket.c:2502 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 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-executor364/3976: #0: ffff800016a13310 (cb_lock){++++}-{3:3}, at: genl_rcv+0x28/0x50 net/netlink/genetlink.c:802 #1: ffff800016a131c8 (genl_mutex){+.+.}-{3:3}, at: genl_lock net/netlink/genetlink.c:33 [inline] #1: ffff800016a131c8 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg+0x114/0x1018 net/netlink/genetlink.c:790 #2: ffff0000c8f285e8 (&genl_data->genl_data_mutex){+.+.}-{3:3}, at: nfc_genl_start_poll+0x1a8/0x308 net/nfc/netlink.c:826 #3: ffff0000c8f28190 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:760 [inline] #3: ffff0000c8f28190 (&dev->mutex){....}-{3:3}, at: nfc_start_poll+0x60/0x2a4 net/nfc/core.c:208 stack backtrace: CPU: 1 PID: 3976 Comm: syz-executor364 Not tainted 5.15.112-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 Call trace: dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 dump_stack+0x1c/0x58 lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2011 check_noncircular+0x2cc/0x378 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 kernel/locking/lockdep.c:3787 [inline] __lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622 __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 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+0x498/0x1204 net/nfc/nci/core.c:838 nfc_start_poll+0x164/0x2a4 net/nfc/core.c:225 nfc_genl_start_poll+0x1b8/0x308 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+0xc18/0x1018 net/netlink/genetlink.c:792 netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2504 genl_rcv+0x38/0x50 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x664/0x938 net/netlink/af_netlink.c:1356 netlink_sendmsg+0x844/0xb38 net/netlink/af_netlink.c:1923 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x584/0x870 net/socket.c:2412 ___sys_sendmsg+0x214/0x294 net/socket.c:2466 __sys_sendmsg net/socket.c:2495 [inline] __do_sys_sendmsg net/socket.c:2504 [inline] __se_sys_sendmsg net/socket.c:2502 [inline] __arm64_sys_sendmsg+0x1ac/0x25c net/socket.c:2502 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 nci: __nci_request: wait_for_completion_interruptible_timeout failed -512 nci: nci_start_poll: failed to set local general bytes nci: __nci_request: wait_for_completion_interruptible_timeout failed 0