Commit f8e96161 authored by Vlad Lungu's avatar Vlad Lungu Committed by David S. Miller

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: default avatarVlad Lungu <vlad.lungu@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6dcdd1b3
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment