提交 d4c642ea 编写于 作者: F Fabio Estevam 提交者: David S. Miller

gianfar: Call netif_carrier_off() prior to registration

Quoting David Miller:
"At the moment you call register_netdev() the device is visible, notifications
are sent to userspace, and userland tools can try to bring the interface up
and see the incorrect link state, before you do the netif_carrier_off().

Said another way, between the register_netdev() and netif_carrier_off() call,
userspace can see the device in an inconsistent state."

So call netif_carrier_off() prior to register_netdev().
Signed-off-by: NFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 3bfdc59a
...@@ -1373,6 +1373,9 @@ static int gfar_probe(struct platform_device *ofdev) ...@@ -1373,6 +1373,9 @@ static int gfar_probe(struct platform_device *ofdev)
gfar_hw_init(priv); gfar_hw_init(priv);
/* Carrier starts down, phylib will bring it up */
netif_carrier_off(dev);
err = register_netdev(dev); err = register_netdev(dev);
if (err) { if (err) {
...@@ -1380,9 +1383,6 @@ static int gfar_probe(struct platform_device *ofdev) ...@@ -1380,9 +1383,6 @@ static int gfar_probe(struct platform_device *ofdev)
goto register_fail; goto register_fail;
} }
/* Carrier starts down, phylib will bring it up */
netif_carrier_off(dev);
device_init_wakeup(&dev->dev, device_init_wakeup(&dev->dev,
priv->device_flags & priv->device_flags &
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET); FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册