mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
comedi: pcm711: Fix sanity check in interrupt handler
The driver requests an interrupt handler for the device before it is fully set up. For safety, the interrupt handler checks the dev->attached flag to ensure the device is fully set up, but it currently does that after dereferencing the dev->read_dev pointer which may be NULL if dev->attached is false. Move the check to avoid the possible null pointer dereference. 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-7-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
13f4796223
commit
f876cbfe3e
|
|
@ -184,7 +184,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d)
|
|||
{
|
||||
struct comedi_device *dev = d;
|
||||
struct comedi_subdevice *s = dev->read_subdev;
|
||||
struct comedi_cmd *cmd = &s->async->cmd;
|
||||
struct comedi_cmd *cmd;
|
||||
unsigned short data;
|
||||
|
||||
if (!dev->attached) {
|
||||
|
|
@ -192,6 +192,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d)
|
|||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
cmd = &s->async->cmd;
|
||||
data = pcl711_ai_get_sample(dev, s);
|
||||
|
||||
outb(PCL711_INT_STAT_CLR, dev->iobase + PCL711_INT_STAT_REG);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user