提交 f8e96161 编写于 作者: V Vlad Lungu 提交者: 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: NVlad Lungu <vlad.lungu@windriver.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6dcdd1b3
...@@ -1509,6 +1509,8 @@ static int stmmac_probe(struct net_device *dev) ...@@ -1509,6 +1509,8 @@ static int stmmac_probe(struct net_device *dev)
pr_warning("\tno valid MAC address;" pr_warning("\tno valid MAC address;"
"please, use ifconfig or nwhwconfig!\n"); "please, use ifconfig or nwhwconfig!\n");
spin_lock_init(&priv->lock);
ret = register_netdev(dev); ret = register_netdev(dev);
if (ret) { if (ret) {
pr_err("%s: ERROR %i registering the device\n", pr_err("%s: ERROR %i registering the device\n",
...@@ -1520,8 +1522,6 @@ static int stmmac_probe(struct net_device *dev) ...@@ -1520,8 +1522,6 @@ static int stmmac_probe(struct net_device *dev)
dev->name, (dev->features & NETIF_F_SG) ? "on" : "off", dev->name, (dev->features & NETIF_F_SG) ? "on" : "off",
(dev->features & NETIF_F_HW_CSUM) ? "on" : "off"); (dev->features & NETIF_F_HW_CSUM) ? "on" : "off");
spin_lock_init(&priv->lock);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册