WARNING in request_threaded_irq (2)

Status: moderation: reported on 2026/12/01 11:08
Subsystems: comedi
Labels: prio:low
[Documentation on labels]
Reported-by: syzbot+50699e1535c984ee0c1d@syzkaller.appspotmail.com
First crash: 1h24m, last: 1h21m
✨ AI cause bisection: introduced by (AI job) :
commit 241ab6ad7108e51c67881f7881c5e46f0400cdb1
Author: David Schleef <ds@schleef.org>
Date: Fri Nov 14 23:03:44 2008 +0000

  Staging: comedi: add comedi_parport driver

✨ AI-generated root cause summary:

When configuring a comedi_parport device via the COMEDI_DEVCONFIG ioctl (do_devconfig_ioctl()), parport_attach() in drivers/comedi/drivers/comedi_parport.c accepts a user-supplied IRQ number it->options[1] in the range 1-15 and passes it directly to request_irq() without verifying irq_is_percpu_devid() or platform ISA support. Because CONFIG_COMEDI_PARPORT only depends on HAS_IOPORT rather than ISA, it can be enabled on non-ISA architectures such as RISC-V where virtual IRQ numbers 1-15 may be allocated to per-CPU interrupts (e.g., via riscv_intc_domain_map() calling irq_set_percpu_devid()). Calling request_irq() on an IRQ with IRQ_PER_CPU_DEVID set triggers WARN_ON(irq_settings_is_per_cpu_devid(desc)) in request_threaded_irq() (kernel/irq/manage.c:2172) and returns -EINVAL.

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit 2359fc3f3501:

Root Cause Analysis

The warning is triggered because parport_attach() in drivers/comedi/drivers/comedi_parport.c passes a user-supplied IRQ number (it->options[1]) directly to request_irq() without checking whether the target IRQ descriptor is a per-CPU interrupt (IRQ_PER_CPU_DEVID) or whether the platform even supports legacy ISA IRQs.

Trigger Path

  1. Userspace invokes the COMEDI_DEVCONFIG ioctl (comedi_unlocked_ioctl() -> do_devconfig_ioctl() in drivers/comedi/comedi_fops.c), passing a struct comedi_devconfig with board_name matching "comedi_parport" and options[0] / options[1] specifying the I/O base address and IRQ number (requires CAP_SYS_ADMIN).
  2. do_devconfig_ioctl() calls comedi_device_attach() (drivers/comedi/drivers.c:1101), which invokes parport_attach(dev, it) (drivers/comedi/drivers/comedi_parport.c:231).
  3. After claiming the I/O port region via comedi_check_request_region(), parport_attach() checks (drivers/comedi/drivers/comedi_parport.c:247-252):
    /* only ISA interrupts are valid on a parallel port */
    if (it->options[1] >= 1 && it->options[1] <= 15) {
        ret = request_irq(it->options[1], parport_interrupt, 0,
                          dev->board_name, dev);
        if (ret == 0)
            dev->irq = it->options[1];
    }
    
  4. Unlike CONFIG_COMEDI_ISA_DRIVERS (which depends on ISA || ISA_BUS || PC104), CONFIG_COMEDI_PARPORT in drivers/comedi/Kconfig only depends on HAS_IOPORT. On non-ISA architectures with CONFIG_HAS_IOPORT=y (such as RISC-V riscv-virtio), Linux IRQ numbers 1..15 are dynamically assigned virtual IRQs rather than fixed ISA IRQs, and may be mapped to per-CPU interruptsβ€”for example by riscv_intc_domain_map() (drivers/irqchip/irq-riscv-intc.c:128), which calls irq_set_percpu_devid(irq) and sets _IRQ_PER_CPU_DEVID in desc->status_use_accessors.
  5. request_irq() calls request_threaded_irq() (kernel/irq/manage.c:2171-2173):
    if (!irq_settings_can_request(desc) ||
        WARN_ON(irq_settings_is_per_cpu_devid(desc)))
        return -EINVAL;
    
    Because irq_settings_is_per_cpu_devid(desc) is true for the per-CPU IRQ, request_threaded_irq() hits the WARN_ON at kernel/irq/manage.c:2172 and returns -EINVAL.

Fix Direction

parport_attach() should validate that the requested IRQ is not a per-CPU devid IRQ (e.g., via !irq_is_percpu_devid(it->options[1])) before calling request_irq(), and/or COMEDI_PARPORT (or its ISA IRQ request path) should be gated appropriately when legacy ISA interrupts are unavailable.

▶ ▼ ✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision
9b82251c bisect-cause IsRelease: ❌ ❓ WARNING in request_threaded_irq (2) 2026/12/01 10:40 2026/12/01 10:40 2026/12/01 11:34 ba8e13b2
ac8cbbb0 assessment-security DenialOfService: ❌ Exploitable: ❌ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ❌ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ WARNING in request_threaded_irq (2) 2026/12/01 10:26 2026/12/01 10:26 2026/12/01 11:08 ba8e13b2
▶ ▼ Similar bugs (1)
Kernel Title Rank πŸ›ˆ Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING in request_threaded_irq prio:low kernel -1 21 218d 283d 0/30 auto-obsoleted due to no activity on 2026/07/06 04:53

Sample crash report:
------------[ cut here ]------------
WARNING: [irq_settings_is_per_cpu_devid(desc)] kernel/irq/manage.c:2172 at request_threaded_irq+0x320/0x38c kernel/irq/manage.c:2172, CPU#1: syz.0.37/4251
Modules linked in:
CPU: 1 UID: 0 PID: 4251 Comm: syz.0.37 Not tainted syzkaller #0 PREEMPT 
Hardware name: riscv-virtio,qemu (DT)
epc : request_threaded_irq+0x320/0x38c kernel/irq/manage.c:2172
 ra : request_threaded_irq+0x320/0x38c kernel/irq/manage.c:2172
epc : ffffffff8034d790 ra : ffffffff8034d790 sp : ffff8f8008ed77e0
 gp : ffffffff8b34ec40 tp : ffffaf8014295040 t0 : ffffffff8007c360
 t1 : ffffffff86c6b4d0 t2 : ffffffff8017df70 s0 : ffff8f8008ed7840
 s1 : 0000000000000000 a0 : 0000000000000005 a1 : 0000000000000000
 a2 : 0000000000080000 a3 : ffffffff8034d790 a4 : ffff8f8004644178
 a5 : 000000000002b178 a6 : 0000000000000003 a7 : 0000000000001fff
 s2 : 0000000000200000 s3 : ffffaf8012d18800 s4 : 0000000000000004
 s5 : ffffffff84f6940a s6 : ffffaf801dec9000 s7 : 0000000000000000
 s8 : ffffffff87c6ede0 s9 : 0000000000020000 s10: ffffaf801dec9000
 s11: 0000000000000001 t3 : 00000000000000c8 t4 : ffffffff92592a60
 t5 : 0000000000000001 t6 : 0000000000000002 ssp : 0000000000000000
status: 0000000200000120 badaddr: ffffffff8034d790 cause: 0000000000000003
[<ffffffff8034d790>] request_threaded_irq+0x320/0x38c kernel/irq/manage.c:2172
[<ffffffff84f69da2>] request_irq include/linux/interrupt.h:178 [inline]
[<ffffffff84f69da2>] parport_attach drivers/comedi/drivers/comedi_parport.c:248 [inline]
[<ffffffff84f69da2>] parport_attach+0x6be/0x906 drivers/comedi/drivers/comedi_parport.c:231
[<ffffffff84f5b1f2>] comedi_device_attach+0x380/0x828 drivers/comedi/drivers.c:1101
[<ffffffff84f46d52>] do_devconfig_ioctl+0x1a2/0x652 drivers/comedi/comedi_fops.c:931
[<ffffffff84f50ee4>] comedi_unlocked_ioctl+0x752/0x30e0 drivers/comedi/comedi_fops.c:2302
[<ffffffff80ddcb18>] vfs_ioctl fs/ioctl.c:52 [inline]
[<ffffffff80ddcb18>] __do_sys_ioctl fs/ioctl.c:598 [inline]
[<ffffffff80ddcb18>] __se_sys_ioctl fs/ioctl.c:584 [inline]
[<ffffffff80ddcb18>] __riscv_sys_ioctl+0x17c/0x1e2 fs/ioctl.c:584
[<ffffffff8007c360>] syscall_handler+0x92/0x114 arch/riscv/include/asm/syscall.h:112
[<ffffffff867ed0d2>] do_trap_ecall_u+0x4ca/0x658 arch/riscv/kernel/traps.c:341
[<ffffffff8681ae60>] handle_exception+0x168/0x174 arch/riscv/kernel/entry.S:237

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/12/01 10:29 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git for-next 2359fc3f3501 f1f6b8bf .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-riscv64 WARNING in request_threaded_irq
2026/12/01 10:26 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git for-next 2359fc3f3501 f1f6b8bf .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-riscv64 WARNING in request_threaded_irq
* Struck through repros no longer work on HEAD.