netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* AX88796: Fix locking in ethtool support
@ 2008-08-07 16:21 Ben Dooks
  2008-08-14  8:44 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks @ 2008-08-07 16:21 UTC (permalink / raw)
  To: netdev; +Cc: jeff, Ben Dooks

[-- Attachment #1: simtec/sparse/sparse-ax88796-locking.patch --]
[-- Type: text/plain, Size: 1159 bytes --]

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>

Index: linux-2.6.27-rc2-quilt1/drivers/net/ax88796.c
===================================================================
--- linux-2.6.27-rc2-quilt1.orig/drivers/net/ax88796.c	2008-08-07 17:15:01.000000000 +0100
+++ linux-2.6.27-rc2-quilt1/drivers/net/ax88796.c	2008-08-07 17:17:45.000000000 +0100
@@ -554,7 +554,7 @@ static int ax_get_settings(struct net_de
 
 	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_de
 
 	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;
 }

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: AX88796: Fix locking in ethtool support
  2008-08-07 16:21 AX88796: Fix locking in ethtool support Ben Dooks
@ 2008-08-14  8:44 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2008-08-14  8:44 UTC (permalink / raw)
  To: Ben Dooks; +Cc: netdev

Ben Dooks wrote:
> 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>
> 
> Index: linux-2.6.27-rc2-quilt1/drivers/net/ax88796.c
> ===================================================================
> --- linux-2.6.27-rc2-quilt1.orig/drivers/net/ax88796.c	2008-08-07 17:15:01.000000000 +0100
> +++ linux-2.6.27-rc2-quilt1/drivers/net/ax88796.c	2008-08-07 17:17:45.000000000 +0100
> @@ -554,7 +554,7 @@ static int ax_get_settings(struct net_de
>  
>  	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_de
>  
>  	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);

applied



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-14  8:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-07 16:21 AX88796: Fix locking in ethtool support Ben Dooks
2008-08-14  8:44 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).