summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2026-06-18 11:09:16 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-07-17 14:55:16 +0200
commitea72e2fc9026f375314421ddfa4dbdc49432a899 (patch)
treeba69c1d2bc7e319cb537c50dc96773da8b215db6 /drivers
parent956e8478261a575d1e87490f2e5db1788b8c209d (diff)
downloadlinux-next-ea72e2fc9026f375314421ddfa4dbdc49432a899.tar.gz
linux-next-ea72e2fc9026f375314421ddfa4dbdc49432a899.zip
comedi: pcmmio: 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 to ensure the device has been fully set up, avoiding a possible null pointer dereference of dev->read_subdev. Reported-by: Jaeyoung Chung <jjy600901@snu.ac.kr> Link: https://lore.kernel.org/lkml/20260610115912.780131-1-jjy600901@snu.ac.kr/ Reported-by: Sangyun Kim <sangyun.kim@snu.ac.kr> Reported-by: Kyungwook Boo <bookyungwook@gmail.com> Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://patch.msgid.link/20260618102949.26607-10-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/comedi/drivers/pcmmio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/comedi/drivers/pcmmio.c b/drivers/comedi/drivers/pcmmio.c
index d38202c8a12b..f42b7343b4e4 100644
--- a/drivers/comedi/drivers/pcmmio.c
+++ b/drivers/comedi/drivers/pcmmio.c
@@ -362,6 +362,9 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d)
unsigned int triggered;
unsigned char int_pend;
+ if (!dev->attached)
+ return IRQ_NONE;
+
/* are there any interrupts pending */
int_pend = inb(dev->iobase + PCMMIO_INT_PENDING_REG) & 0x07;
if (!int_pend)