[syzbot] [comedi?] INFO: task hung in comedi_open

13 views
Skip to first unread message

syzbot

unread,
Aug 4, 2025, 12:50:31 PM8/4/25
to abb...@mev.co.uk, hswe...@visionengravers.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 84b92a499e7e Add linux-next specific files for 20250731
git tree: linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=17c98042580000
kernel config: https://syzkaller.appspot.com/x/.config?x=ebe1ab9de0458a0b
dashboard link: https://syzkaller.appspot.com/bug?extid=7811bb68a317954a0347
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14e5f834580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=119a2aa2580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/9166103a92de/disk-84b92a49.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f3e30ff276de/vmlinux-84b92a49.xz
kernel image: https://storage.googleapis.com/syzbot-assets/febfe91281d4/bzImage-84b92a49.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+7811bb...@syzkaller.appspotmail.com

INFO: task syz-executor352:5876 blocked for more than 143 seconds.
Not tainted 6.16.0-next-20250731-syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz-executor352 state:D stack:26008 pid:5876 tgid:5876 ppid:5875 task_flags:0x400040 flags:0x00004006
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5357 [inline]
__schedule+0x1798/0x4cc0 kernel/sched/core.c:6961
__schedule_loop kernel/sched/core.c:7043 [inline]
schedule+0x165/0x360 kernel/sched/core.c:7058
schedule_preempt_disabled+0x13/0x30 kernel/sched/core.c:7115
__mutex_lock_common kernel/locking/mutex.c:676 [inline]
__mutex_lock+0x7e6/0x1360 kernel/locking/mutex.c:760
comedi_open+0xc0/0x590 drivers/comedi/comedi_fops.c:2863
chrdev_open+0x4c9/0x5e0 fs/char_dev.c:414
do_dentry_open+0x953/0x13f0 fs/open.c:965
vfs_open+0x3b/0x340 fs/open.c:1095
do_open fs/namei.c:3887 [inline]
path_openat+0x2ee5/0x3830 fs/namei.c:4046
do_filp_open+0x1fa/0x410 fs/namei.c:4073
do_sys_openat2+0x121/0x1c0 fs/open.c:1435
do_sys_open fs/open.c:1450 [inline]
__do_sys_openat fs/open.c:1466 [inline]
__se_sys_openat fs/open.c:1461 [inline]
__x64_sys_openat+0x138/0x170 fs/open.c:1461
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fab9116dc29
RSP: 002b:00007ffffb9ee4a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fab9116dc29
RDX: 0000000000000400 RSI: 0000200000000080 RDI: ffffffffffffff9c
RBP: 00000000000f4240 R08: 0000000000000000 R09: 00000000000000a0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffffb9ee6c8 R14: 00007ffffb9ee4d0 R15: 00007ffffb9ee4c0
</TASK>
INFO: task syz-executor352:5879 blocked for more than 143 seconds.
Not tainted 6.16.0-next-20250731-syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz-executor352 state:D stack:27816 pid:5879 tgid:5879 ppid:5877 task_flags:0x400040 flags:0x00004006
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5357 [inline]
__schedule+0x1798/0x4cc0 kernel/sched/core.c:6961
__schedule_loop kernel/sched/core.c:7043 [inline]
schedule+0x165/0x360 kernel/sched/core.c:7058
schedule_preempt_disabled+0x13/0x30 kernel/sched/core.c:7115
__mutex_lock_common kernel/locking/mutex.c:676 [inline]
__mutex_lock+0x7e6/0x1360 kernel/locking/mutex.c:760
comedi_open+0xc0/0x590 drivers/comedi/comedi_fops.c:2863
chrdev_open+0x4c9/0x5e0 fs/char_dev.c:414
do_dentry_open+0x953/0x13f0 fs/open.c:965
vfs_open+0x3b/0x340 fs/open.c:1095
do_open fs/namei.c:3887 [inline]
path_openat+0x2ee5/0x3830 fs/namei.c:4046
do_filp_open+0x1fa/0x410 fs/namei.c:4073
do_sys_openat2+0x121/0x1c0 fs/open.c:1435
do_sys_open fs/open.c:1450 [inline]
__do_sys_openat fs/open.c:1466 [inline]
__se_sys_openat fs/open.c:1461 [inline]
__x64_sys_openat+0x138/0x170 fs/open.c:1461
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fab9116dc29
RSP: 002b:00007ffffb9ee4a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fab9116dc29
RDX: 0000000000000400 RSI: 0000200000000080 RDI: ffffffffffffff9c
RBP: 00000000000f4240 R08: 0000000000000000 R09: 00000000000000a0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffffb9ee6c8 R14: 00007ffffb9ee4d0 R15: 00007ffffb9ee4c0
</TASK>
INFO: task syz-executor352:5880 blocked for more than 144 seconds.
Not tainted 6.16.0-next-20250731-syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz-executor352 state:D stack:27704 pid:5880 tgid:5880 ppid:5878 task_flags:0x400040 flags:0x00004006
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5357 [inline]
__schedule+0x1798/0x4cc0 kernel/sched/core.c:6961
__schedule_loop kernel/sched/core.c:7043 [inline]
schedule+0x165/0x360 kernel/sched/core.c:7058
schedule_preempt_disabled+0x13/0x30 kernel/sched/core.c:7115
__mutex_lock_common kernel/locking/mutex.c:676 [inline]
__mutex_lock+0x7e6/0x1360 kernel/locking/mutex.c:760
comedi_open+0xc0/0x590 drivers/comedi/comedi_fops.c:2863
chrdev_open+0x4c9/0x5e0 fs/char_dev.c:414
do_dentry_open+0x953/0x13f0 fs/open.c:965
vfs_open+0x3b/0x340 fs/open.c:1095
do_open fs/namei.c:3887 [inline]
path_openat+0x2ee5/0x3830 fs/namei.c:4046
do_filp_open+0x1fa/0x410 fs/namei.c:4073
do_sys_openat2+0x121/0x1c0 fs/open.c:1435
do_sys_open fs/open.c:1450 [inline]
__do_sys_openat fs/open.c:1466 [inline]
__se_sys_openat fs/open.c:1461 [inline]
__x64_sys_openat+0x138/0x170 fs/open.c:1461
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fab9116dc29
RSP: 002b:00007ffffb9ee4a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fab9116dc29
RDX: 0000000000000400 RSI: 0000200000000080 RDI: ffffffffffffff9c
RBP: 00000000000f4240 R08: 0000000000000000 R09: 00000000000000a0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffffb9ee6c8 R14: 00007ffffb9ee4d0 R15: 00007ffffb9ee4c0
</TASK>

Showing all locks held in the system:
1 lock held by khungtaskd/31:
#0: ffffffff8e539f20 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline]
#0: ffffffff8e539f20 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline]
#0: ffffffff8e539f20 (rcu_read_lock){....}-{1:3}, at: debug_show_all_locks+0x2e/0x180 kernel/locking/lockdep.c:6775
2 locks held by getty/5610:
#0: ffff8880304030a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x25/0x70 drivers/tty/tty_ldisc.c:243
#1: ffffc9000332b2f0 (&ldata->atomic_read_lock){+.+.}-{4:4}, at: n_tty_read+0x43e/0x1400 drivers/tty/n_tty.c:2222
2 locks held by syz-executor352/5874:
1 lock held by syz-executor352/5876:
#0: ffff88814c5a48f8 (&dev->mutex#4){+.+.}-{4:4}, at: comedi_open+0xc0/0x590 drivers/comedi/comedi_fops.c:2863
1 lock held by syz-executor352/5879:
#0: ffff88814c5a48f8 (&dev->mutex#4){+.+.}-{4:4}, at: comedi_open+0xc0/0x590 drivers/comedi/comedi_fops.c:2863
1 lock held by syz-executor352/5880:
#0: ffff88814c5a48f8 (&dev->mutex#4){+.+.}-{4:4}, at: comedi_open+0xc0/0x590 drivers/comedi/comedi_fops.c:2863

=============================================

NMI backtrace for cpu 0
CPU: 0 UID: 0 PID: 31 Comm: khungtaskd Not tainted 6.16.0-next-20250731-syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
<TASK>
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
nmi_cpu_backtrace+0x39e/0x3d0 lib/nmi_backtrace.c:113
nmi_trigger_cpumask_backtrace+0x17a/0x300 lib/nmi_backtrace.c:62
trigger_all_cpu_backtrace include/linux/nmi.h:160 [inline]
check_hung_uninterruptible_tasks kernel/hung_task.c:328 [inline]
watchdog+0xf93/0xfe0 kernel/hung_task.c:491
kthread+0x70e/0x8a0 kernel/kthread.c:463
ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
Sending NMI from CPU 0 to CPUs 1:
NMI backtrace for cpu 1
CPU: 1 UID: 0 PID: 2995 Comm: kworker/u8:7 Not tainted 6.16.0-next-20250731-syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Workqueue: events_unbound toggle_allocation_gate
RIP: 0010:hlock_class kernel/locking/lockdep.c:234 [inline]
RIP: 0010:check_wait_context kernel/locking/lockdep.c:4879 [inline]
RIP: 0010:__lock_acquire+0x50c/0xd20 kernel/locking/lockdep.c:5187
Code: 49 83 c7 28 41 89 c4 48 39 cb 0f 8d d6 00 00 00 48 83 fb 31 0f 83 92 00 00 00 41 8b 07 25 ff 1f 00 00 48 0f a3 05 04 7f 4b 12 <73> 10 48 69 c0 c8 00 00 00 48 8d 88 30 23 8a 93 eb 40 83 3d 6b 0e
RSP: 0018:ffffc9000b5574d8 EFLAGS: 00000007
RAX: 0000000000000003 RBX: 0000000000000002 RCX: 0000000000000005
RDX: 0000000000000003 RSI: 0000000000000000 RDI: ffff88802f255a00
RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff821029a9
R10: dffffc0000000000 R11: fffff94000010c31 R12: 00000000ffffff05
R13: 0000000000000001 R14: ffff88802f2565b8 R15: ffff88802f256560
FS: 0000000000000000(0000) GS:ffff88812590a000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000561e277c9168 CR3: 000000000e336000 CR4: 00000000003526f0
Call Trace:
<TASK>
lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
rcu_lock_acquire include/linux/rcupdate.h:331 [inline]
rcu_read_lock include/linux/rcupdate.h:841 [inline]
___pte_offset_map+0x45/0x250 mm/pgtable-generic.c:286
__pte_offset_map include/linux/mm.h:3037 [inline]
__pte_offset_map_lock+0x46/0x210 mm/pgtable-generic.c:397
get_locked_pte include/linux/mm.h:2745 [inline]
__text_poke+0x2e6/0xa10 arch/x86/kernel/alternative.c:2504
text_poke arch/x86/kernel/alternative.c:2589 [inline]
smp_text_poke_batch_finish+0xd0f/0x1130 arch/x86/kernel/alternative.c:2978
arch_jump_label_transform_apply+0x1c/0x30 arch/x86/kernel/jump_label.c:146
static_key_enable_cpuslocked+0x128/0x250 kernel/jump_label.c:210
static_key_enable+0x1a/0x20 kernel/jump_label.c:223
toggle_allocation_gate+0xad/0x240 mm/kfence/core.c:850
process_one_work kernel/workqueue.c:3236 [inline]
process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3319
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
kthread+0x70e/0x8a0 kernel/kthread.c:463
ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
INFO: NMI handler (nmi_cpu_backtrace_handler) took too long to run: 1.133 msecs


---
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 syzk...@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 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.

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

Nikita Zhandarovich

unread,
Oct 20, 2025, 1:59:23 PM10/20/25
to syzbot+7811bb...@syzkaller.appspotmail.com, Nikita Zhandarovich, syzkall...@googlegroups.com, linux-...@vger.kernel.org
#syz test

---
drivers/comedi/drivers/multiq3.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/comedi/drivers/multiq3.c b/drivers/comedi/drivers/multiq3.c
index 467587b0b250..dc27651e0ace 100644
--- a/drivers/comedi/drivers/multiq3.c
+++ b/drivers/comedi/drivers/multiq3.c
@@ -67,6 +67,11 @@
#define MULTIQ3_TRSFRCNTR_OL 0x10 /* xfer CNTR to OL (x and y) */
#define MULTIQ3_EFLAG_RESET 0x06 /* reset E bit of flag reg */

+/*
+ * Semi-arbitrary limit on the number of optional encoder chips
+ */
+#define MULTIQ3_MAX_ENC_CHIPS 16
+
static void multiq3_set_ctrl(struct comedi_device *dev, unsigned int bits)
{
/*
@@ -314,6 +319,11 @@ static int multiq3_attach(struct comedi_device *dev,

/* Encoder (Counter) subdevice */
s = &dev->subdevices[4];
+
+ /* sanity check for number of optional encoders */
+ if (it->options[2] > MULTIQ3_MAX_ENC_CHIPS)
+ it->options[2] = MULTIQ3_MAX_ENC_CHIPS;
+
s->type = COMEDI_SUBD_COUNTER;
s->subdev_flags = SDF_READABLE | SDF_LSAMPL;
s->n_chan = it->options[2] * 2;

syzbot

unread,
Oct 20, 2025, 7:53:04 PM10/20/25
to linux-...@vger.kernel.org, n.zhand...@fintech.ru, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+7811bb...@syzkaller.appspotmail.com
Tested-by: syzbot+7811bb...@syzkaller.appspotmail.com

Tested on:

commit: 606da5bb Add linux-next specific files for 20251020
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=112943cd980000
kernel config: https://syzkaller.appspot.com/x/.config?x=be983e1d3d00440c
dashboard link: https://syzkaller.appspot.com/bug?extid=7811bb68a317954a0347
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=14df9734580000

Note: testing is done by a robot and is best-effort only.

Nikita Zhandarovich

unread,
Oct 21, 2025, 8:24:48 AM10/21/25
to syzbot+7811bb...@syzkaller.appspotmail.com, Nikita Zhandarovich, syzkall...@googlegroups.com, linux-...@vger.kernel.org
#syz test

---
drivers/comedi/drivers/multiq3.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/comedi/drivers/multiq3.c b/drivers/comedi/drivers/multiq3.c
index 07ff5383da99..0248321e3bfa 100644
--- a/drivers/comedi/drivers/multiq3.c
+++ b/drivers/comedi/drivers/multiq3.c
@@ -67,6 +67,11 @@
#define MULTIQ3_TRSFRCNTR_OL 0x10 /* xfer CNTR to OL (x and y) */
#define MULTIQ3_EFLAG_RESET 0x06 /* reset E bit of flag reg */

+/*
+ * Semi-arbitrary limit on the number of optional encoder chips
+ */
+#define MULTIQ3_MAX_ENC_CHIPS 16
+
static void multiq3_set_ctrl(struct comedi_device *dev, unsigned int bits)
{
/*
@@ -312,6 +317,10 @@ static int multiq3_attach(struct comedi_device *dev,
s->insn_read = multiq3_encoder_insn_read;
s->insn_config = multiq3_encoder_insn_config;

+ /* sanity check for number of optional encoders */
+ if (s->n_chan > MULTIQ3_MAX_ENC_CHIPS)
+ s->n_chan = MULTIQ3_MAX_ENC_CHIPS;
+
for (i = 0; i < s->n_chan; i++)
multiq3_encoder_reset(dev, i);

syzbot

unread,
Oct 21, 2025, 10:41:05 AM10/21/25
to linux-...@vger.kernel.org, n.zhand...@fintech.ru, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+7811bb...@syzkaller.appspotmail.com
Tested-by: syzbot+7811bb...@syzkaller.appspotmail.com

Tested on:

commit: fe45352c Add linux-next specific files for 20251021
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=11e30d2f980000
kernel config: https://syzkaller.appspot.com/x/.config?x=122d1f1adc0d9241
dashboard link: https://syzkaller.appspot.com/bug?extid=7811bb68a317954a0347
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=17b21b04580000
Reply all
Reply to author
Forward
0 new messages