[PATCH] comedi: comedi_parport: reject per-CPU devid IRQs in parport_attach()
From: Thanh Nguyen
Date: Fri Dec 04 2026 - 08:55:36 EST
parport_attach() accepts a user-supplied IRQ number in the legacy ISA
range 1..15 from COMEDI_DEVCONFIG (it->options[1]) and passes it
directly to request_irq().
Because CONFIG_COMEDI_PARPORT only depends on HAS_IOPORT, it can be
enabled on non-ISA architectures such as RISC-V where virtual IRQ
numbers 1..15 may be mapped to per-CPU interrupts (IRQ_PER_CPU_DEVID).
Calling request_irq() on such an IRQ triggers
WARN_ON(irq_settings_is_per_cpu_devid(desc)) in request_threaded_irq()
and returns -EINVAL.
Skip requesting the interrupt when irq_is_percpu_devid() is true, so
the device still attaches without interrupt support as it does when
request_irq() fails.
Reported-by: syzbot+516526e174b85b412d92@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=516526e174b85b412d92
Fixes: 241ab6ad7108 ("Staging: comedi: add comedi_parport driver")
Signed-off-by: Thanh Nguyen <thanhnguyentuan2007@xxxxxxxxx>
---
drivers/comedi/drivers/comedi_parport.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/comedi/drivers/comedi_parport.c b/drivers/comedi/drivers/comedi_parport.c
index 94284ff15..fe444cb6f 100644
--- a/drivers/comedi/drivers/comedi_parport.c
+++ b/drivers/comedi/drivers/comedi_parport.c
@@ -57,6 +57,7 @@
#include <linux/module.h>
#include <linux/interrupt.h>
+#include <linux/irq.h>
#include <linux/comedi/comedidev.h>
/*
@@ -244,7 +245,8 @@ static int parport_attach(struct comedi_device *dev,
outb(0, dev->iobase + PARPORT_CTRL_REG);
/* only ISA interrupts are valid on a parallel port */
- if (it->options[1] >= 1 && it->options[1] <= 15) {
+ if (it->options[1] >= 1 && it->options[1] <= 15 &&
+ !irq_is_percpu_devid(it->options[1])) {
ret = request_irq(it->options[1], parport_interrupt, 0,
dev->board_name, dev);
if (ret == 0)
--
2.56.1