nci: __nci_request: wait_for_completion_interruptible_timeout failed 0 ====================================================== WARNING: possible circular locking dependency detected 5.15.98-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor667/4053 is trying to acquire lock: ffff800015cd4fe8 (nci_mutex){+.+.}-{3:3}, at: virtual_nci_close+0x28/0x58 drivers/nfc/virtual_ncidev.c:44 but task is already holding lock: ffff0000d01f9350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_close_device+0xf0/0x5dc net/nfc/nci/core.c:560 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&ndev->req_lock){+.+.}-{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 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:2533 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+0x814/0xb00 net/netlink/af_netlink.c:1952 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 :584 -> #2 (&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:1819 process_one_work+0x82c/0x1478 kernel/workqueue.c:2306 worker_thread+0x910/0x1034 kernel/workqueue.c:2453 kthread+0x37c/0x45c kernel/kthread.c:319 ret_from_fork+0x10/0x20 :870 -> #1 (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:3480 [inline] path_openat+0x1f00/0x26c4 fs/namei.c:3615 do_filp_open+0x1a8/0x3b4 fs/namei.c:3642 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 :584 -> #0 (nci_mutex){+.+.}-{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+0x2b8/0x894 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 virtual_nci_close+0x28/0x58 drivers/nfc/virtual_ncidev.c:44 nci_close_device+0x304/0x5dc net/nfc/nci/core.c:592 nci_unregister_device+0x5c/0x22c net/nfc/nci/core.c:1295 virtual_ncidev_close+0x70/0xb0 drivers/nfc/virtual_ncidev.c:166 __fput+0x30c/0x7f0 fs/file_table.c:280 ____fput+0x20/0x30 fs/file_table.c:308 task_work_run+0x130/0x1e4 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline] el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:597 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 :584 other info that might help us debug this: Chain exists of: nci_mutex --> &genl_data->genl_data_mutex --> &ndev->req_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ndev->req_lock); lock(&genl_data->genl_data_mutex); lock(&ndev->req_lock); lock(nci_mutex); *** DEADLOCK *** 1 lock held by syz-executor667/4053: #0: ffff0000d01f9350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_close_device+0xf0/0x5dc net/nfc/nci/core.c:560 stack backtrace: CPU: 1 PID: 4053 Comm: syz-executor667 Not tainted 5.15.98-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/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+0x2b8/0x894 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 virtual_nci_close+0x28/0x58 drivers/nfc/virtual_ncidev.c:44 nci_close_device+0x304/0x5dc net/nfc/nci/core.c:592 nci_unregister_device+0x5c/0x22c net/nfc/nci/core.c:1295 virtual_ncidev_close+0x70/0xb0 drivers/nfc/virtual_ncidev.c:166 __fput+0x30c/0x7f0 fs/file_table.c:280 ____fput+0x20/0x30 fs/file_table.c:308 task_work_run+0x130/0x1e4 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline] el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:597 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 :584