nci: __nci_request: wait_for_completion_interruptible_timeout failed 0 ====================================================== WARNING: possible circular locking dependency detected 6.1.0-rc6-syzkaller-00251-g0b1dcc2cf55a #0 Not tainted ------------------------------------------------------ syz-executor186/3643 is trying to acquire lock: ffffffff8d25a428 (nci_mutex){+.+.}-{3:3}, at: virtual_nci_close+0x17/0x50 drivers/nfc/virtual_ncidev.c:44 but task is already holding lock: ffff888077e4d350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_close_device+0x6d/0x370 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 kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 nci_request net/nfc/nci/core.c:148 [inline] nci_set_local_general_bytes net/nfc/nci/core.c:774 [inline] nci_start_poll+0x688/0x900 net/nfc/nci/core.c:838 nfc_start_poll+0x192/0x320 net/nfc/core.c:225 nfc_genl_start_poll+0x1ac/0x490 net/nfc/netlink.c:828 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:756 genl_family_rcv_msg net/netlink/genetlink.c:833 [inline] genl_rcv_msg+0x445/0x780 net/netlink/genetlink.c:850 netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540 genl_rcv+0x28/0x40 net/netlink/genetlink.c:861 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536 __sys_sendmsg+0xf7/0x1c0 net/socket.c:2565 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #2 (&genl_data->genl_data_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 nfc_urelease_event_work+0x143/0x2d0 net/nfc/netlink.c:1811 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 -> #1 (nfc_devlist_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 nfc_register_device+0x32/0x3b0 net/nfc/core.c:1116 nci_register_device+0x7cb/0xb50 net/nfc/nci/core.c:1256 virtual_ncidev_open+0x71/0x110 drivers/nfc/virtual_ncidev.c:146 misc_open+0x37a/0x4a0 drivers/char/misc.c:143 chrdev_open+0x26a/0x770 fs/char_dev.c:414 do_dentry_open+0x6cc/0x13f0 fs/open.c:882 do_open fs/namei.c:3557 [inline] path_openat+0x1bf6/0x2860 fs/namei.c:3714 do_filp_open+0x1ba/0x410 fs/namei.c:3741 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_openat fs/open.c:1342 [inline] __se_sys_openat fs/open.c:1337 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1337 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (nci_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 virtual_nci_close+0x17/0x50 drivers/nfc/virtual_ncidev.c:44 nci_close_device+0x231/0x370 net/nfc/nci/core.c:592 nci_unregister_device+0x38/0x310 net/nfc/nci/core.c:1291 virtual_ncidev_close+0x71/0x90 drivers/nfc/virtual_ncidev.c:166 __fput+0x27c/0xa90 fs/file_table.c:320 task_work_run+0x16f/0x270 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xb3d/0x2a30 kernel/exit.c:820 do_group_exit+0xd4/0x2a0 kernel/exit.c:950 get_signal+0x21b1/0x2440 kernel/signal.c:2858 arch_do_signal_or_restart+0x86/0x2300 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd 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-executor186/3643: #0: ffff888077e4d350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_close_device+0x6d/0x370 net/nfc/nci/core.c:560 stack backtrace: CPU: 0 PID: 3643 Comm: syz-executor186 Not tainted 6.1.0-rc6-syzkaller-00251-g0b1dcc2cf55a #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2177 check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 virtual_nci_close+0x17/0x50 drivers/nfc/virtual_ncidev.c:44 nci_close_device+0x231/0x370 net/nfc/nci/core.c:592 nci_unregister_device+0x38/0x310 net/nfc/nci/core.c:1291 virtual_ncidev_close+0x71/0x90 drivers/nfc/virtual_ncidev.c:166 __fput+0x27c/0xa90 fs/file_table.c:320 task_work_run+0x16f/0x270 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xb3d/0x2a30 kernel/exit.c:820 do_group_exit+0xd4/0x2a0 kernel/exit.c:950 get_signal+0x21b1/0x2440 kernel/signal.c:2858 arch_do_signal_or_restart+0x86/0x2300 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fa8cf9b8329 Code: Unable to access opcode bytes at 0x7fa8cf9b82ff. RSP: 002b:00007fa8cf95c1d8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: 0000000000000024 RBX: 00007fa8cfa3a4c8 RCX: 00007fa8cf9b8329 RDX: 0000000000000000 RSI: 0000000020000440 RDI: 0000000000000005 RBP: 00007fa8cfa3a4c0 R08: 0000000000000000 R09: 000000000