* [syzbot] [net?] [nfc?] WARNING in nfc_dev_down
@ 2025-12-15 12:40 syzbot
2025-12-16 4:58 ` syzbot
2025-12-17 5:17 ` Forwarded: [PATCH] net: nfc: fix deadlock between nfc_unregister_device and rfkill_fop_write syzbot
0 siblings, 2 replies; 4+ messages in thread
From: syzbot @ 2025-12-15 12:40 UTC (permalink / raw)
To: davem, edumazet, horms, krzk, kuba, linux-kernel, netdev, pabeni,
syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: d358e5254674 Merge tag 'for-6.19/dm-changes' of git://git...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13b2961a580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f315601b98a91c0b
dashboard link: https://syzkaller.appspot.com/bug?extid=4ef89409a235d804c6c2
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/def5abdae246/disk-d358e525.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/171af6e9cc68/vmlinux-d358e525.xz
kernel image: https://storage.googleapis.com/syzbot-assets/2342dcd05182/bzImage-d358e525.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4ef89409a235d804c6c2@syzkaller.appspotmail.com
------------[ cut here ]------------
rtmutex deadlock detected
WARNING: kernel/locking/rtmutex.c:1674 at 0x0, CPU#1: syz.4.2932/13586
Modules linked in:
CPU: 1 UID: 0 PID: 13586 Comm: syz.4.2932 Tainted: G L syzkaller #0 PREEMPT_{RT,(full)}
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
RIP: 0010:rt_mutex_handle_deadlock+0x21/0xb0 kernel/locking/rtmutex.c:1674
Code: 90 90 90 90 90 90 90 90 90 41 57 41 56 41 55 41 54 53 83 ff dd 0f 85 86 00 00 00 48 89 f7 e8 66 3b 01 00 48 8d 3d cf eb 08 04 <67> 48 0f b9 3a 4c 8d 3d 00 00 00 00 65 48 8b 1c 25 08 a0 b1 91 4c
RSP: 0018:ffffc900040d78b0 EFLAGS: 00010286
RAX: 0000000080000000 RBX: ffffc900040d7940 RCX: 0000000000000000
RDX: 0000000000000006 RSI: ffffffff8ce093ac RDI: ffffffff8ede2bf0
RBP: ffffc900040d7a58 R08: ffffffff8edb0977 R09: 1ffffffff1db612e
R10: dffffc0000000000 R11: fffffbfff1db612f R12: 1ffff9200081af24
R13: ffffffff8ad53b09 R14: ffff8880382f9098 R15: dffffc0000000000
FS: 00007f35de10c6c0(0000) GS:ffff888126e06000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055558f47b588 CR3: 0000000063c72000 CR4: 00000000003526f0
Call Trace:
<TASK>
__rt_mutex_slowlock kernel/locking/rtmutex.c:1734 [inline]
__rt_mutex_slowlock_locked kernel/locking/rtmutex.c:1760 [inline]
rt_mutex_slowlock+0x666/0x6b0 kernel/locking/rtmutex.c:1800
__rt_mutex_lock kernel/locking/rtmutex.c:1815 [inline]
__mutex_lock_common kernel/locking/rtmutex_api.c:534 [inline]
mutex_lock_nested+0x16a/0x1d0 kernel/locking/rtmutex_api.c:552
device_lock include/linux/device.h:895 [inline]
nfc_dev_down+0x3b/0x290 net/nfc/core.c:143
nfc_rfkill_set_block+0x2d/0x100 net/nfc/core.c:179
rfkill_set_block+0x1e5/0x450 net/rfkill/core.c:346
rfkill_fop_write+0x44e/0x580 net/rfkill/core.c:1301
do_loop_readv_writev fs/read_write.c:850 [inline]
vfs_writev+0x4bf/0x970 fs/read_write.c:1059
do_writev+0x153/0x2d0 fs/read_write.c:1103
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f35dfeef749
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f35de10c038 EFLAGS: 00000246 ORIG_RAX: 0000000000000014
RAX: ffffffffffffffda RBX: 00007f35e0146180 RCX: 00007f35dfeef749
RDX: 0000000000000001 RSI: 0000200000000500 RDI: 0000000000000004
RBP: 00007f35dff73f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f35e0146218 R14: 00007f35e0146180 R15: 00007ffd7e110468
</TASK>
----------------
Code disassembly (best guess):
0: 90 nop
1: 90 nop
2: 90 nop
3: 90 nop
4: 90 nop
5: 90 nop
6: 90 nop
7: 90 nop
8: 90 nop
9: 41 57 push %r15
b: 41 56 push %r14
d: 41 55 push %r13
f: 41 54 push %r12
11: 53 push %rbx
12: 83 ff dd cmp $0xffffffdd,%edi
15: 0f 85 86 00 00 00 jne 0xa1
1b: 48 89 f7 mov %rsi,%rdi
1e: e8 66 3b 01 00 call 0x13b89
23: 48 8d 3d cf eb 08 04 lea 0x408ebcf(%rip),%rdi # 0x408ebf9
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: 4c 8d 3d 00 00 00 00 lea 0x0(%rip),%r15 # 0x36
36: 65 48 8b 1c 25 08 a0 mov %gs:0xffffffff91b1a008,%rbx
3d: b1 91
3f: 4c rex.WR
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [syzbot] [net?] [nfc?] WARNING in nfc_dev_down
2025-12-15 12:40 [syzbot] [net?] [nfc?] WARNING in nfc_dev_down syzbot
@ 2025-12-16 4:58 ` syzbot
2025-12-17 5:17 ` Forwarded: [PATCH] net: nfc: fix deadlock between nfc_unregister_device and rfkill_fop_write syzbot
1 sibling, 0 replies; 4+ messages in thread
From: syzbot @ 2025-12-16 4:58 UTC (permalink / raw)
To: davem, edumazet, horms, krzk, kuba, linux-kernel, netdev, pabeni,
syzkaller-bugs
syzbot has found a reproducer for the following issue on:
HEAD commit: 8f0b4cce4481 Linux 6.19-rc1
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=102035c2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=1f2b6fe1fdf1a00b
dashboard link: https://syzkaller.appspot.com/bug?extid=4ef89409a235d804c6c2
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1101b91a580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=142035c2580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ea3b19e4d883/disk-8f0b4cce.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/bd7c115820ba/vmlinux-8f0b4cce.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e5813cc1963f/bzImage-8f0b4cce.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4ef89409a235d804c6c2@syzkaller.appspotmail.com
------------[ cut here ]------------
rtmutex deadlock detected
WARNING: kernel/locking/rtmutex.c:1674 at rt_mutex_handle_deadlock+0x21/0xb0 kernel/locking/rtmutex.c:1674, CPU#1: syz.3.31/6310
Modules linked in:
CPU: 1 UID: 0 PID: 6310 Comm: syz.3.31 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
RIP: 0010:rt_mutex_handle_deadlock+0x21/0xb0 kernel/locking/rtmutex.c:1674
Code: 90 90 90 90 90 90 90 90 90 41 57 41 56 41 55 41 54 53 83 ff dd 0f 85 86 00 00 00 48 89 f7 e8 66 3b 01 00 48 8d 3d 6f 83 08 04 <67> 48 0f b9 3a 4c 8d 3d 00 00 00 00 65 48 8b 1c 25 08 d0 b1 91 4c
RSP: 0018:ffffc90004d97930 EFLAGS: 00010286
RAX: 0000000080000000 RBX: ffffc90004d979c0 RCX: 0000000000000000
RDX: 0000000000000006 RSI: ffffffff8ce0bc0c RDI: ffffffff8ede53f0
RBP: ffffc90004d97ad8 R08: ffffffff8edb3177 R09: 1ffffffff1db662e
R10: dffffc0000000000 R11: fffffbfff1db662f R12: 1ffff920009b2f34
R13: ffffffff8ad5cb69 R14: ffff888037dc6098 R15: dffffc0000000000
FS: 000055557d26b500(0000) GS:ffff888126e03000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffcf0a37f52 CR3: 00000000329d0000 CR4: 00000000003526f0
Call Trace:
<TASK>
__rt_mutex_slowlock kernel/locking/rtmutex.c:1734 [inline]
__rt_mutex_slowlock_locked kernel/locking/rtmutex.c:1760 [inline]
rt_mutex_slowlock+0x666/0x6b0 kernel/locking/rtmutex.c:1800
__rt_mutex_lock kernel/locking/rtmutex.c:1815 [inline]
__mutex_lock_common kernel/locking/rtmutex_api.c:534 [inline]
mutex_lock_nested+0x16a/0x1d0 kernel/locking/rtmutex_api.c:552
device_lock include/linux/device.h:895 [inline]
nfc_dev_down+0x3b/0x290 net/nfc/core.c:143
nfc_rfkill_set_block+0x2d/0x100 net/nfc/core.c:179
rfkill_set_block+0x1e5/0x450 net/rfkill/core.c:346
rfkill_fop_write+0x44e/0x580 net/rfkill/core.c:1301
vfs_write+0x287/0xb40 fs/read_write.c:684
ksys_write+0x14b/0x260 fs/read_write.c:738
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f28f61cf749
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffd96926f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f28f6425fa0 RCX: 00007f28f61cf749
RDX: 0000000000000008 RSI: 0000200000000080 RDI: 0000000000000004
RBP: 00007f28f6253f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f28f6425fa0 R14: 00007f28f6425fa0 R15: 0000000000000003
</TASK>
----------------
Code disassembly (best guess):
0: 90 nop
1: 90 nop
2: 90 nop
3: 90 nop
4: 90 nop
5: 90 nop
6: 90 nop
7: 90 nop
8: 90 nop
9: 41 57 push %r15
b: 41 56 push %r14
d: 41 55 push %r13
f: 41 54 push %r12
11: 53 push %rbx
12: 83 ff dd cmp $0xffffffdd,%edi
15: 0f 85 86 00 00 00 jne 0xa1
1b: 48 89 f7 mov %rsi,%rdi
1e: e8 66 3b 01 00 call 0x13b89
23: 48 8d 3d 6f 83 08 04 lea 0x408836f(%rip),%rdi # 0x4088399
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: 4c 8d 3d 00 00 00 00 lea 0x0(%rip),%r15 # 0x36
36: 65 48 8b 1c 25 08 d0 mov %gs:0xffffffff91b1d008,%rbx
3d: b1 91
3f: 4c rex.WR
---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Forwarded: [PATCH] net: nfc: fix deadlock between nfc_unregister_device and rfkill_fop_write
2025-12-15 12:40 [syzbot] [net?] [nfc?] WARNING in nfc_dev_down syzbot
2025-12-16 4:58 ` syzbot
@ 2025-12-17 5:17 ` syzbot
1 sibling, 0 replies; 4+ messages in thread
From: syzbot @ 2025-12-17 5:17 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: [PATCH] net: nfc: fix deadlock between nfc_unregister_device and rfkill_fop_write
Author: kartikey406@gmail.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
A deadlock can occur between nfc_unregister_device() and rfkill_fop_write()
due to lock ordering inversion between device_lock and rfkill_global_mutex.
The problematic lock order is:
Thread A (rfkill_fop_write):
rfkill_fop_write()
mutex_lock(&rfkill_global_mutex)
rfkill_set_block()
nfc_rfkill_set_block()
nfc_dev_down()
device_lock(&dev->dev) <- waits for device_lock
Thread B (nfc_unregister_device):
nfc_unregister_device()
device_lock(&dev->dev)
rfkill_unregister()
mutex_lock(&rfkill_global_mutex) <- waits for rfkill_global_mutex
This creates a classic ABBA deadlock scenario.
Fix this by moving rfkill_unregister() and rfkill_destroy() outside the
device_lock critical section. To ensure safety, set shutting_down flag
first and store rfkill pointer in a local variable before releasing the
lock. The shutting_down flag ensures that nfc_dev_down() and nfc_dev_up()
will bail out early if called during device unregistration.
Reported-by: syzbot+4ef89409a235d804c6c2@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=4ef89409a235d804c6c2
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
net/nfc/core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/net/nfc/core.c b/net/nfc/core.c
index ae1c842f9c64..201d2b95432b 100644
--- a/net/nfc/core.c
+++ b/net/nfc/core.c
@@ -1154,7 +1154,7 @@ EXPORT_SYMBOL(nfc_register_device);
void nfc_unregister_device(struct nfc_dev *dev)
{
int rc;
-
+ struct rfkill *rfk = NULL;
pr_debug("dev_name=%s\n", dev_name(&dev->dev));
rc = nfc_genl_device_removed(dev);
@@ -1164,13 +1164,17 @@ void nfc_unregister_device(struct nfc_dev *dev)
device_lock(&dev->dev);
if (dev->rfkill) {
- rfkill_unregister(dev->rfkill);
- rfkill_destroy(dev->rfkill);
+ rfk = dev->rfkill;
dev->rfkill = NULL;
}
dev->shutting_down = true;
device_unlock(&dev->dev);
+ if (rfk) {
+ rfkill_unregister(rfk);
+ rfkill_destroy(rfk);
+ }
+
if (dev->ops->check_presence) {
timer_delete_sync(&dev->check_pres_timer);
cancel_work_sync(&dev->check_pres_work);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [syzbot] [net?] [nfc?] WARNING in nfc_dev_down
[not found] <20251217051654.115173-1-kartikey406@gmail.com>
@ 2025-12-17 5:40 ` syzbot
0 siblings, 0 replies; 4+ messages in thread
From: syzbot @ 2025-12-17 5:40 UTC (permalink / raw)
To: kartikey406, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
BUG: MAX_LOCKDEP_KEYS too low!
BUG: MAX_LOCKDEP_KEYS too low!
turning off the locking correctness validator.
CPU: 0 UID: 0 PID: 24046 Comm: syz.4.2543 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
Call Trace:
<TASK>
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
register_lock_class+0x2dc/0x320 kernel/locking/lockdep.c:1332
__lock_acquire+0xae/0x2cf0 kernel/locking/lockdep.c:5112
lock_acquire+0x117/0x340 kernel/locking/lockdep.c:5868
touch_wq_lockdep_map+0xcb/0x180 kernel/workqueue.c:3940
__flush_workqueue+0x121/0x14b0 kernel/workqueue.c:3982
drain_workqueue+0xd3/0x390 kernel/workqueue.c:4146
destroy_workqueue+0xbb/0xc60 kernel/workqueue.c:5903
nci_unregister_device+0x8b/0x240 net/nfc/nci/core.c:1315
virtual_ncidev_close+0x59/0x90 drivers/nfc/virtual_ncidev.c:172
__fput+0x45b/0xa80 fs/file_table.c:468
task_work_run+0x1d4/0x260 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:44 [inline]
exit_to_user_mode_loop+0xff/0x4f0 kernel/entry/common.c:75
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline]
syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline]
do_syscall_64+0x2d0/0xf80 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5494d2f749
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd69399a18 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007f5494f87da0 RCX: 00007f5494d2f749
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007f5494f87da0 R08: 0000000000000000 R09: 0000000469399d0f
R10: 000000000003fdb4 R11: 0000000000000246 R12: 0000000000065bb6
R13: 00007f5494f86180 R14: ffffffffffffffff R15: 00007ffd69399b30
</TASK>
Tested on:
commit: ea1013c1 Merge tag 'bpf-fixes' of git://git.kernel.org..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=147aa31a580000
kernel config: https://syzkaller.appspot.com/x/.config?x=1f2b6fe1fdf1a00b
dashboard link: https://syzkaller.appspot.com/bug?extid=4ef89409a235d804c6c2
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
patch: https://syzkaller.appspot.com/x/patch.diff?x=12071d92580000
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-17 5:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-15 12:40 [syzbot] [net?] [nfc?] WARNING in nfc_dev_down syzbot
2025-12-16 4:58 ` syzbot
2025-12-17 5:17 ` Forwarded: [PATCH] net: nfc: fix deadlock between nfc_unregister_device and rfkill_fop_write syzbot
[not found] <20251217051654.115173-1-kartikey406@gmail.com>
2025-12-17 5:40 ` [syzbot] [net?] [nfc?] WARNING in nfc_dev_down syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox