diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2014-06-03 18:55:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-06-05 18:03:46 -0400 |
commit | d4c642ea1239f0c5c1d794a5b788319d3373c58c (patch) | |
tree | fefa5990e0a8cdfa5ce21b997297805fc6b68592 | |
parent | 3bfdc59a6c24608ed23e903f670aaf5f58c7a6f3 (diff) |
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: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/freescale/gianfar.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index e2d42475b006..c81625ade4a3 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -1373,6 +1373,9 @@ static int gfar_probe(struct platform_device *ofdev) | |||
1373 | 1373 | ||
1374 | gfar_hw_init(priv); | 1374 | gfar_hw_init(priv); |
1375 | 1375 | ||
1376 | /* Carrier starts down, phylib will bring it up */ | ||
1377 | netif_carrier_off(dev); | ||
1378 | |||
1376 | err = register_netdev(dev); | 1379 | err = register_netdev(dev); |
1377 | 1380 | ||
1378 | if (err) { | 1381 | if (err) { |
@@ -1380,9 +1383,6 @@ static int gfar_probe(struct platform_device *ofdev) | |||
1380 | goto register_fail; | 1383 | goto register_fail; |
1381 | } | 1384 | } |
1382 | 1385 | ||
1383 | /* Carrier starts down, phylib will bring it up */ | ||
1384 | netif_carrier_off(dev); | ||
1385 | |||
1386 | device_init_wakeup(&dev->dev, | 1386 | device_init_wakeup(&dev->dev, |
1387 | priv->device_flags & | 1387 | priv->device_flags & |
1388 | FSL_GIANFAR_DEV_HAS_MAGIC_PACKET); | 1388 | FSL_GIANFAR_DEV_HAS_MAGIC_PACKET); |