possible deadlock in nci_close_device (2)

Status: upstream: reported on 2026/09/17 11:39
Reported-by: syzbot+ddad7434ea7bad960d8d@syzkaller.appspotmail.com
First crash: 30d, last: 17d
▶ ▼ Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in nci_close_device 4 1 927d 927d 0/3 auto-obsoleted due to no activity on 2024/07/12 04:08
linux-5.15 possible deadlock in nci_close_device (2) 4 2 25d 25d 0/3 upstream: reported on 2026/09/22 16:02
upstream possible deadlock in nci_close_device net nfc 4 2 1411d 1425d 22/29 fixed on 2023/02/24 13:50
linux-5.15 possible deadlock in nci_close_device 4 1 1105d 1105d 0/3 auto-obsoleted due to no activity on 2024/01/16 04:06

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.4.5/4389 is trying to acquire lock:
ffff88807bef6938 ((wq_completion)nfc2_nci_tx_wq){+.+.}-{0:0}, at: __flush_workqueue+0x14c/0x1380 kernel/workqueue.c:2812

but task is already holding lock:
ffff88802f089350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_close_device+0x102/0x600 net/nfc/nci/core.c:560

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #5 (&ndev->req_lock){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747
       nci_request net/nfc/nci/core.c:148 [inline]
       nci_set_local_general_bytes net/nfc/nci/core.c:776 [inline]
       nci_start_poll+0x529/0xcc0 net/nfc/nci/core.c:840
       nfc_start_poll+0x141/0x2c0 net/nfc/core.c:225
       nfc_genl_start_poll+0x1d7/0x340 net/nfc/netlink.c:828
       genl_family_rcv_msg_doit+0x22f/0x350 net/netlink/genetlink.c:756
       genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
       genl_rcv_msg+0x601/0x790 net/netlink/genetlink.c:850
       netlink_rcv_skb+0x1ef/0x440 net/netlink/af_netlink.c:2516
       genl_rcv+0x24/0x40 net/netlink/genetlink.c:861
       netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
       netlink_unicast+0x7ad/0x920 net/netlink/af_netlink.c:1344
       netlink_sendmsg+0x8ad/0xbd0 net/netlink/af_netlink.c:1877
       sock_sendmsg_nosec net/socket.c:718 [inline]
       __sock_sendmsg net/socket.c:730 [inline]
       ____sys_sendmsg+0x5ed/0x9a0 net/socket.c:2519
       ___sys_sendmsg+0x2a2/0x360 net/socket.c:2573
       __sys_sendmsg net/socket.c:2602 [inline]
       __do_sys_sendmsg net/socket.c:2611 [inline]
       __se_sys_sendmsg+0x1c3/0x2b0 net/socket.c:2609
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #4 (&genl_data->genl_data_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747
       nfc_urelease_event_work+0x120/0x310 net/nfc/netlink.c:1849
       process_one_work+0x8ab/0x1160 kernel/workqueue.c:2292
       worker_thread+0xaf5/0x12a0 kernel/workqueue.c:2439
       kthread+0x29d/0x330 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

-> #3 (nfc_devlist_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747
       nfc_register_device+0x38/0x300 net/nfc/core.c:1116
       nci_register_device+0x89f/0x9f0 net/nfc/nci/core.c:1272
       virtual_ncidev_open+0x55/0xc0 drivers/nfc/virtual_ncidev.c:146
       misc_open+0x31f/0x390 drivers/char/misc.c:145
       chrdev_open+0x585/0x5f0 fs/char_dev.c:414
       do_dentry_open+0x7dd/0x10b0 fs/open.c:882
       do_open fs/namei.c:3677 [inline]
       path_openat+0x2674/0x2f10 fs/namei.c:3834
       do_filp_open+0x1ee/0x420 fs/namei.c:3861
       do_sys_openat2+0x14b/0x4f0 fs/open.c:1320
       do_sys_open fs/open.c:1336 [inline]
       __do_sys_openat fs/open.c:1352 [inline]
       __se_sys_openat fs/open.c:1347 [inline]
       __x64_sys_openat+0x135/0x160 fs/open.c:1347
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #2 (
nci_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747
       virtual_nci_send+0x1d/0xd0 drivers/nfc/virtual_ncidev.c:54
       nci_tx_work+0x19f/0x3a0 net/nfc/nci/core.c:1527
       process_one_work+0x8ab/0x1160 kernel/workqueue.c:2292
       worker_thread+0xaf5/0x12a0 kernel/workqueue.c:2439
       kthread+0x29d/0x330 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

-> #1 ((work_completion)(&ndev->tx_work)){+.+.}-{0:0}:
       process_one_work+0x7ec/0x1160 kernel/workqueue.c:2268
       worker_thread+0xaf5/0x12a0 kernel/workqueue.c:2439
       kthread+0x29d/0x330 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

-> #0 ((wq_completion)nfc2_nci_tx_wq){+.+.}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3095 [inline]
       check_prevs_add kernel/locking/lockdep.c:3214 [inline]
       validate_chain kernel/locking/lockdep.c:3830 [inline]
       __lock_acquire+0x2d18/0x7c40 kernel/locking/lockdep.c:5063
       lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5678
       __flush_workqueue+0x165/0x1380 kernel/workqueue.c:2812
       nci_close_device+0x172/0x600 net/nfc/nci/core.c:578
       nci_unregister_device+0x5e/0x250 net/nfc/nci/core.c:1309
       virtual_ncidev_close+0x55/0x90 drivers/nfc/virtual_ncidev.c:166
       __fput+0x20a/0x8b0 fs/file_table.c:320
       task_work_run+0x1d0/0x260 kernel/task_work.c:203
       resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
       exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:180
       exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:213
       __syscall_exit_to_user_mode_work kernel/entry/common.c:295 [inline]
       syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:306
       do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:82
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Chain exists of:
  (wq_completion)nfc2_nci_tx_wq --> &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((wq_completion)nfc2_nci_tx_wq);

 *** DEADLOCK ***

1 lock held by syz.4.5/4389:
 #0: ffff88802f089350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_close_device+0x102/0x600 net/nfc/nci/core.c:560

stack backtrace:
CPU: 1 PID: 4389 Comm: syz.4.5 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
 check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3095 [inline]
 check_prevs_add kernel/locking/lockdep.c:3214 [inline]
 validate_chain kernel/locking/lockdep.c:3830 [inline]
 __lock_acquire+0x2d18/0x7c40 kernel/locking/lockdep.c:5063
 lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5678
 __flush_workqueue+0x165/0x1380 kernel/workqueue.c:2812
 nci_close_device+0x172/0x600 net/nfc/nci/core.c:578
 nci_unregister_device+0x5e/0x250 net/nfc/nci/core.c:1309
 virtual_ncidev_close+0x55/0x90 drivers/nfc/virtual_ncidev.c:166
 __fput+0x20a/0x8b0 fs/file_table.c:320
 task_work_run+0x1d0/0x260 kernel/task_work.c:203
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:180
 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:213
 __syscall_exit_to_user_mode_work kernel/entry/common.c:295 [inline]
 syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:306
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fb61919e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffddbc44e8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007fb619427da0 RCX: 00007fb61919e159
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007fb619427da0 R08: 00007fb619426038 R09: 0000000000000000
R10: 00000000003ffba8 R11: 0000000000000246 R12: 0000000000015bbd
R13: 00007fb619425fac R14: 000000000001593b R15: 00007fffddbc45f0
 </TASK>
nci: __nci_request: wait_for_completion_interruptible_timeout failed -512
------------[ cut here ]------------
ODEBUG: free active (active state 0) object type: timer_list hint: arch_atomic_set arch/x86/include/asm/atomic.h:-1 [inline]
ODEBUG: free active (active state 0) object type: timer_list hint: atomic_set include/linux/atomic/atomic-instrumented.h:42 [inline]
ODEBUG: free active (active state 0) object type: timer_list hint: nci_data_timer+0x0/0x60 net/nfc/nci/core.c:616
WARNING: CPU: 0 PID: 4389 at lib/debugobjects.c:518 debug_print_object lib/debugobjects.c:515 [inline]
WARNING: CPU: 0 PID: 4389 at lib/debugobjects.c:518 __debug_check_no_obj_freed lib/debugobjects.c:1045 [inline]
WARNING: CPU: 0 PID: 4389 at lib/debugobjects.c:518 debug_check_no_obj_freed+0x395/0x520 lib/debugobjects.c:1075
Modules linked in:
CPU: 0 PID: 4389 Comm: syz.4.5 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:debug_print_object lib/debugobjects.c:515 [inline]
RIP: 0010:__debug_check_no_obj_freed lib/debugobjects.c:1045 [inline]
RIP: 0010:debug_check_no_obj_freed+0x395/0x520 lib/debugobjects.c:1075
Code: e8 a0 b5 b8 fd 4c 8b 45 00 48 c7 c7 60 72 df 8a 48 c7 c6 c0 6e df 8a 48 c7 c2 c0 73 df 8a 8b 4c 24 1c 4d 89 e9 e8 9b f7 32 fd <0f> 0b 4c 8b 6c 24 10 48 b9 00 00 00 00 00 fc ff df ff 05 0c 27 06
RSP: 0018:ffffc90004907c50 EFLAGS: 00010246
RAX: d6b58cf99824e900 RBX: ffffffff96e2dfe0 RCX: ffff88807d349e00
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000002
RBP: ffffffff8a8df5e0 R08: ffffc900049078c7 R09: 1ffff92000920f18
R10: dffffc0000000000 R11: fffff52000920f19 R12: 0000000000000001
R13: ffffffff8a0222e0 R14: ffff88802f089000 R15: ffff88802f0890a0
FS:  000055555e8c3500(0000) GS:ffff8880b8e00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffe15e74fe8 CR3: 000000007725f000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 slab_free_hook mm/slub.c:1704 [inline]
 slab_free_freelist_hook+0xd2/0x1b0 mm/slub.c:1755
 slab_free mm/slub.c:3687 [inline]
 __kmem_cache_free+0xb6/0x200 mm/slub.c:3700
 virtual_ncidev_close+0x61/0x90 drivers/nfc/virtual_ncidev.c:167
 __fput+0x20a/0x8b0 fs/file_table.c:320
 task_work_run+0x1d0/0x260 kernel/task_work.c:203
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:180
 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:213
 __syscall_exit_to_user_mode_work kernel/entry/common.c:295 [inline]
 syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:306
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fb61919e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffddbc44e8 EFLAGS: 00000246
 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007fb619427da0 RCX: 00007fb61919e159
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007fb619427da0 R08: 00007fb619426038 R09: 0000000000000000
R10: 00000000003ffba8 R11: 0000000000000246 R12: 0000000000015bbd
R13: 00007fb619425fac R14: 000000000001593b R15: 00007fffddbc45f0
 </TASK>

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/09/22 12:38 linux-6.1.y 1a8763b93150 e12281bd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in nci_close_device
2026/09/30 17:47 linux-6.1.y 1a8763b93150 7808aef4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in nci_close_device
2026/09/22 12:55 linux-6.1.y 1a8763b93150 e12281bd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in nci_close_device
2026/09/22 12:55 linux-6.1.y 1a8763b93150 e12281bd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in nci_close_device
2026/09/17 12:41 linux-6.1.y 1a8763b93150 95928915 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in nci_close_device
2026/09/17 11:38 linux-6.1.y 1a8763b93150 95928915 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in nci_close_device
* Struck through repros no longer work on HEAD.