All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stmmac: priv->lock can be used uninitialized
@ 2010-11-30  8:52 Vlad Lungu
  2010-11-30 14:12 ` Peppe CAVALLARO
  2010-12-02 21:19 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Vlad Lungu @ 2010-11-30  8:52 UTC (permalink / raw)
  To: netdev; +Cc: peppe.cavallaro, davem, Vlad Lungu

To reproduce: if connman (http://connman.net/) is started,
inserting the stmmac module triggers a "BUG: spinlock bad magic on CPU#0".

Registering the device in stmmac_probe() sends a notification to connman
which brings the interface up before the lock is initialized.

Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
---
 drivers/net/stmmac/stmmac_main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index 730a6fd..e960501 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -1516,6 +1516,8 @@ static int stmmac_probe(struct net_device *dev)
 		pr_warning("\tno valid MAC address;"
 			"please, use ifconfig or nwhwconfig!\n");
 
+	spin_lock_init(&priv->lock);
+
 	ret = register_netdev(dev);
 	if (ret) {
 		pr_err("%s: ERROR %i registering the device\n",
@@ -1527,8 +1529,6 @@ static int stmmac_probe(struct net_device *dev)
 	    dev->name, (dev->features & NETIF_F_SG) ? "on" : "off",
 	    (dev->features & NETIF_F_HW_CSUM) ? "on" : "off");
 
-	spin_lock_init(&priv->lock);
-
 	return ret;
 }
 
-- 
1.6.0.2


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

* Re: [PATCH] stmmac: priv->lock can be used uninitialized
  2010-11-30  8:52 [PATCH] stmmac: priv->lock can be used uninitialized Vlad Lungu
@ 2010-11-30 14:12 ` Peppe CAVALLARO
  2010-12-02 21:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Peppe CAVALLARO @ 2010-11-30 14:12 UTC (permalink / raw)
  To: Vlad Lungu; +Cc: netdev, davem

Hi Vlad.

On 11/30/2010 9:52 AM, Vlad Lungu wrote:
>
> To reproduce: if connman (http://connman.net/) is started,
> inserting the stmmac module triggers a "BUG: spinlock bad magic on CPU#0".
>
> Registering the device in stmmac_probe() sends a notification to connman
> which brings the interface up before the lock is initialized.
>

I've never tested connman on our ST platforms.
I've never seen this problems too.
I've no concerns on it so it could be applied.

Regards
Peppe

> Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
> ---
>  drivers/net/stmmac/stmmac_main.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/stmmac/stmmac_main.c
> b/drivers/net/stmmac/stmmac_main.c
> index 730a6fd..e960501 100644
> --- a/drivers/net/stmmac/stmmac_main.c
> +++ b/drivers/net/stmmac/stmmac_main.c
> @@ -1516,6 +1516,8 @@ static int stmmac_probe(struct net_device *dev)
>                 pr_warning("\tno valid MAC address;"
>                         "please, use ifconfig or nwhwconfig!\n");
>
> +       spin_lock_init(&priv->lock);
> +
>         ret = register_netdev(dev);
>         if (ret) {
>                 pr_err("%s: ERROR %i registering the device\n",
> @@ -1527,8 +1529,6 @@ static int stmmac_probe(struct net_device *dev)
>             dev->name, (dev->features & NETIF_F_SG) ? "on" : "off",
>             (dev->features & NETIF_F_HW_CSUM) ? "on" : "off");
>
> -       spin_lock_init(&priv->lock);
> -
>         return ret;
>  }
>
> --
> 1.6.0.2
>

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

* Re: [PATCH] stmmac: priv->lock can be used uninitialized
  2010-11-30  8:52 [PATCH] stmmac: priv->lock can be used uninitialized Vlad Lungu
  2010-11-30 14:12 ` Peppe CAVALLARO
@ 2010-12-02 21:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2010-12-02 21:19 UTC (permalink / raw)
  To: vlad.lungu; +Cc: netdev, peppe.cavallaro

From: Vlad Lungu <vlad.lungu@windriver.com>
Date: Tue, 30 Nov 2010 10:52:52 +0200

> To reproduce: if connman (http://connman.net/) is started,
> inserting the stmmac module triggers a "BUG: spinlock bad magic on CPU#0".
> 
> Registering the device in stmmac_probe() sends a notification to connman
> which brings the interface up before the lock is initialized.
> 
> Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>

Applied, thanks.

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

end of thread, other threads:[~2010-12-02 21:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-30  8:52 [PATCH] stmmac: priv->lock can be used uninitialized Vlad Lungu
2010-11-30 14:12 ` Peppe CAVALLARO
2010-12-02 21:19 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.