Commit dfee325a authored by Rasesh Mody's avatar Rasesh Mody Committed by David S. Miller

bna: MBOX IRQ Flag Check after Locking

Change details:
 - Check the BNAD_RF_MBOX_IRQ_DISABLED flag after acquiring the bna_lock,
   since checking the flag and executing bna_mbox_handler needs to be atomic.
   If not, it opens up window where flag is reset when it was checked, but got
   set while spinning on the lock by the other thread which is actually
   holding the lock
Signed-off-by: default avatarGurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: default avatarRasesh Mody <rmody@brocade.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 761fab37
...@@ -586,10 +586,11 @@ bnad_msix_mbox_handler(int irq, void *data) ...@@ -586,10 +586,11 @@ bnad_msix_mbox_handler(int irq, void *data)
unsigned long flags; unsigned long flags;
struct bnad *bnad = (struct bnad *)data; struct bnad *bnad = (struct bnad *)data;
if (unlikely(test_bit(BNAD_RF_MBOX_IRQ_DISABLED, &bnad->run_flags)))
return IRQ_HANDLED;
spin_lock_irqsave(&bnad->bna_lock, flags); spin_lock_irqsave(&bnad->bna_lock, flags);
if (unlikely(test_bit(BNAD_RF_MBOX_IRQ_DISABLED, &bnad->run_flags))) {
spin_unlock_irqrestore(&bnad->bna_lock, flags);
return IRQ_HANDLED;
}
bna_intr_status_get(&bnad->bna, intr_status); bna_intr_status_get(&bnad->bna, intr_status);
...@@ -612,15 +613,18 @@ bnad_isr(int irq, void *data) ...@@ -612,15 +613,18 @@ bnad_isr(int irq, void *data)
struct bnad_rx_ctrl *rx_ctrl; struct bnad_rx_ctrl *rx_ctrl;
struct bna_tcb *tcb = NULL; struct bna_tcb *tcb = NULL;
if (unlikely(test_bit(BNAD_RF_MBOX_IRQ_DISABLED, &bnad->run_flags))) spin_lock_irqsave(&bnad->bna_lock, flags);
if (unlikely(test_bit(BNAD_RF_MBOX_IRQ_DISABLED, &bnad->run_flags))) {
spin_unlock_irqrestore(&bnad->bna_lock, flags);
return IRQ_NONE; return IRQ_NONE;
}
bna_intr_status_get(&bnad->bna, intr_status); bna_intr_status_get(&bnad->bna, intr_status);
if (unlikely(!intr_status)) if (unlikely(!intr_status)) {
spin_unlock_irqrestore(&bnad->bna_lock, flags);
return IRQ_NONE; return IRQ_NONE;
}
spin_lock_irqsave(&bnad->bna_lock, flags);
if (BNA_IS_MBOX_ERR_INTR(&bnad->bna, intr_status)) if (BNA_IS_MBOX_ERR_INTR(&bnad->bna, intr_status))
bna_mbox_handler(&bnad->bna, intr_status); bna_mbox_handler(&bnad->bna, intr_status);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment