Skip to content

Commit

Permalink
gianfar: Call netif_carrier_off() prior to registration
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Fabio Estevam authored and David S. Miller committed Jun 5, 2014
1 parent 3bfdc59 commit d4c642e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/freescale/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1373,16 +1373,16 @@ static int gfar_probe(struct platform_device *ofdev)

gfar_hw_init(priv);

/* Carrier starts down, phylib will bring it up */
netif_carrier_off(dev);

err = register_netdev(dev);

if (err) {
pr_err("%s: Cannot register net device, aborting\n", dev->name);
goto register_fail;
}

/* Carrier starts down, phylib will bring it up */
netif_carrier_off(dev);

device_init_wakeup(&dev->dev,
priv->device_flags &
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
Expand Down

0 comments on commit d4c642e

Please sign in to comment.