]> err.no Git - linux-2.6/commitdiff
AX88796: Fix locking in ethtool support
authorBen Dooks <ben-linux@fluff.org>
Thu, 7 Aug 2008 16:21:09 +0000 (17:21 +0100)
committerJeff Garzik <jgarzik@redhat.com>
Thu, 14 Aug 2008 08:44:21 +0000 (04:44 -0400)
Fix a pair of nasty locking problems in the ax88796 driver
spotted by a sparse check:

warning: context imbalance in 'ax_get_settings' - wrong count at exit
warning: context imbalance in 'ax_set_settings' - wrong count at exit

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/ax88796.c

index 0b4adf4a0f7da9ab772ca84bc1d4738ca034c263..a886a4b9f7e5e24b97f7efe6f3e3aba559221cf9 100644 (file)
@@ -554,7 +554,7 @@ static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 
        spin_lock_irqsave(&ax->mii_lock, flags);
        mii_ethtool_gset(&ax->mii, cmd);
-       spin_lock_irqsave(&ax->mii_lock, flags);
+       spin_unlock_irqrestore(&ax->mii_lock, flags);
 
        return 0;
 }
@@ -567,7 +567,7 @@ static int ax_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 
        spin_lock_irqsave(&ax->mii_lock, flags);
        rc = mii_ethtool_sset(&ax->mii, cmd);
-       spin_lock_irqsave(&ax->mii_lock, flags);
+       spin_unlock_irqrestore(&ax->mii_lock, flags);
 
        return rc;
 }