mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 14:33:24 -04:00
comedi: das6402: 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-3-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1ca4475191
commit
e90d0550c5
@@ -173,10 +173,16 @@ static irqreturn_t das6402_interrupt(int irq, void *d)
|
||||
{
|
||||
struct comedi_device *dev = d;
|
||||
struct comedi_subdevice *s = dev->read_subdev;
|
||||
struct comedi_async *async = s->async;
|
||||
struct comedi_cmd *cmd = &async->cmd;
|
||||
struct comedi_async *async;
|
||||
struct comedi_cmd *cmd;
|
||||
unsigned int status;
|
||||
|
||||
if (!dev->attached)
|
||||
return IRQ_NONE;
|
||||
|
||||
async = s->async;
|
||||
cmd = &async->cmd;
|
||||
|
||||
status = inb(dev->iobase + DAS6402_STATUS_REG);
|
||||
if ((status & DAS6402_STATUS_INT) == 0)
|
||||
return IRQ_NONE;
|
||||
|
||||
Reference in New Issue
Block a user