orinoco: fix unsafe locking in spectrum_cs_suspend
authorDavid Kilroy <kilroyd@googlemail.com>
Fri, 10 Oct 2008 21:58:32 +0000 (22:58 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 15 Oct 2008 01:08:11 +0000 (21:08 -0400)
A similar problem was highlighted in the orinoco_cs driver by lockdep.
This patch fixes the spectrum_cs driver.

Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/spectrum_cs.c

index 67b26d3c3cd50548a1b4639ffb949b4345a98906..f5513cd4db35331d6b126242e65fb9dd90da76ba 100644 (file)
@@ -450,10 +450,11 @@ spectrum_cs_suspend(struct pcmcia_device *link)
 {
        struct net_device *dev = link->priv;
        struct orinoco_private *priv = netdev_priv(dev);
+       unsigned long flags;
        int err = 0;
 
        /* Mark the device as stopped, to block IO until later */
-       spin_lock(&priv->lock);
+       spin_lock_irqsave(&priv->lock, flags);
 
        err = __orinoco_down(dev);
        if (err)
@@ -463,7 +464,7 @@ spectrum_cs_suspend(struct pcmcia_device *link)
        netif_device_detach(dev);
        priv->hw_unavailable++;
 
-       spin_unlock(&priv->lock);
+       spin_unlock_irqrestore(&priv->lock, flags);
 
        return err;
 }