summaryrefslogtreecommitdiffstats
path: root/drivers/net/stmmac
diff options
context:
space:
mode:
authorVlad Lungu <vlad.lungu@windriver.com>2010-11-29 23:52:52 +0100
committerDavid S. Miller <davem@davemloft.net>2010-12-02 22:19:48 +0100
commitf8e9616108c7003e6499c162459258f11c9dc85e (patch)
tree76b43ae643ff2e2898b18fd45b8b680d14221c1e /drivers/net/stmmac
parentnet/ipv6/sit.c: return unhandled skb to tunnel4_rcv (diff)
downloadlinux-f8e9616108c7003e6499c162459258f11c9dc85e.tar.xz
linux-f8e9616108c7003e6499c162459258f11c9dc85e.zip
stmmac: priv->lock can be used uninitialized
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>
Diffstat (limited to 'drivers/net/stmmac')
-rw-r--r--drivers/net/stmmac/stmmac_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index 06bc6034ce81..2114837809e7 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -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",
@@ -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;
}