summaryrefslogtreecommitdiff
path: root/drivers/comedi
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2026-06-18 11:09:17 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-07-17 14:55:16 +0200
commit6f6f6644e011fa910db744e9978127a443b94001 (patch)
tree84a7fb840696799a89b315dcc5a40e0136ba3bfe /drivers/comedi
parentea72e2fc9026f375314421ddfa4dbdc49432a899 (diff)
downloadlinux-next-6f6f6644e011fa910db744e9978127a443b94001.tar.gz
linux-next-6f6f6644e011fa910db744e9978127a443b94001.zip
comedi: pcmuio: Add sanity check to interrupt handler
The driver requests an interrupt handler for the device, after setting device registers to disable interrupt generation. The interrupt handler should not be called prematurely unless the user-configured I/O port base address and/or IRQ number are incorrect or the hardware is bad. For safety, check the dev->attached flag in the interrupt handler pcmuio_interrupt() to ensure the device has been fully set up, avoiding a possible null pointer dereference of dev->subdevices by pcmuio_handle_asic_interrupt(). Also make use of the IRQ_HANDLED(x) macro for the normal return path of the interrupt handler. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://patch.msgid.link/20260618102949.26607-11-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/comedi')
-rw-r--r--drivers/comedi/drivers/pcmuio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/comedi/drivers/pcmuio.c b/drivers/comedi/drivers/pcmuio.c
index 0995911a3ea3..d9995cbeecb6 100644
--- a/drivers/comedi/drivers/pcmuio.c
+++ b/drivers/comedi/drivers/pcmuio.c
@@ -362,12 +362,15 @@ static irqreturn_t pcmuio_interrupt(int irq, void *d)
struct pcmuio_private *devpriv = dev->private;
int handled = 0;
+ if (!dev->attached)
+ return IRQ_NONE;
+
if (irq == dev->irq)
handled += pcmuio_handle_asic_interrupt(dev, 0);
if (irq == devpriv->irq2)
handled += pcmuio_handle_asic_interrupt(dev, 1);
- return handled ? IRQ_HANDLED : IRQ_NONE;
+ return IRQ_RETVAL(handled);
}
/* chip->spinlock is already locked */