From: Thanh Nguyen <thanhnguyentuan2007@gmail.com>
To: Ian Abbott <abbotti@mev.co.uk>,
H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org,
syzbot+516526e174b85b412d92@syzkaller.appspotmail.com,
Thanh Nguyen <thanhnguyentuan2007@gmail.com>
Subject: [PATCH] comedi: comedi_parport: reject per-CPU devid IRQs in parport_attach()
Date: Fri, 4 Dec 2026 08:55:19 -0500 [thread overview]
Message-ID: <20261204135519.1759-1-thanhnguyentuan2007@gmail.com> (raw)
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
reply other threads:[~2026-12-04 13:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204135519.1759-1-thanhnguyentuan2007@gmail.com \
--to=thanhnguyentuan2007@gmail.com \
--cc=abbotti@mev.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+516526e174b85b412d92@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®