mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] comedi: comedi_parport: reject per-CPU devid IRQs in parport_attach()
@ 2026-12-04 13:55 Thanh Nguyen
  0 siblings, 0 replies; only message in thread
From: Thanh Nguyen @ 2026-12-04 13:55 UTC (permalink / raw)
  To: Ian Abbott, H Hartley Sweeten
  Cc: Greg Kroah-Hartman, linux-kernel, syzbot+516526e174b85b412d92,
	Thanh Nguyen

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@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=516526e174b85b412d92
Fixes: 241ab6ad7108 ("Staging: comedi: add comedi_parport driver")
Signed-off-by: Thanh Nguyen <thanhnguyentuan2007@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-04 13:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-04 13:55 [PATCH] comedi: comedi_parport: reject per-CPU devid IRQs in parport_attach() Thanh Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®