From 00e2f365a35596e47705b657459364cd65c44353 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Mon, 28 Jun 2004 01:03:01 +0000 Subject: [PATCH] fix possible crash when shared interrupt is asserted before comedi_device_attach() has finished with postconfig() --- comedi/drivers.c | 2 +- comedi/drivers/ni_mio_common.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/comedi/drivers.c b/comedi/drivers.c index 66f16ec0..527e711f 100644 --- a/comedi/drivers.c +++ b/comedi/drivers.c @@ -182,7 +182,7 @@ attached: printk("BUG: dev->board_name=<%p>\n",dev->board_name); dev->board_name="BUG"; } - barrier(); + mb(); dev->attached=1; return 0; diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 8892704f..0200ae9a 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -375,6 +375,8 @@ static irqreturn_t ni_E_interrupt(int irq,void *d,struct pt_regs * regs) #ifdef PCIDMA struct mite_struct *mite = devpriv->mite; #endif + + if(dev->attached == 0) return IRQ_NONE; // lock to avoid race with comedi_poll comedi_spin_lock_irqsave(&dev->spinlock, flags); a_status=win_in(AI_Status_1_Register); -- 2.26.2