Skip to content

Commit

Permalink
stmmac: priv->lock can be used uninitialized
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vlad Lungu authored and David S. Miller committed Dec 2, 2010
1 parent 6dcdd1b commit f8e9616
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,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",
Expand All @@ -1520,8 +1522,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;
}

Expand Down

0 comments on commit f8e9616

Please sign in to comment.