sata_mv: fix MSI irq race condition
authorMark Lord <liml@rtr.ca>
Tue, 10 Mar 2009 20:28:51 +0000 (16:28 -0400)
committerJeff Garzik <jgarzik@redhat.com>
Fri, 13 Mar 2009 18:55:44 +0000 (14:55 -0400)
Fix a (rare) race condition in mv_interrupt() when using MSI.

The value of hpriv->main_irq_mask_addr can change on on the fly,
and without this patch we could end up writing back a stale copy
to the hardware.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/sata_mv.c

index 7007edd2d4517fed1a5b75773622cae9da003e44..74b1080d116da102d714c2168ca85f7e8c00fc0b 100644 (file)
@@ -2218,12 +2218,13 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance)
                else
                        handled = mv_host_intr(host, pending_irqs);
        }
-       spin_unlock(&host->lock);
 
        /* for MSI: unmask; interrupt cause bits will retrigger now */
        if (using_msi)
                writel(hpriv->main_irq_mask, hpriv->main_irq_mask_addr);
 
+       spin_unlock(&host->lock);
+
        return IRQ_RETVAL(handled);
 }