diff options
author | David S. Miller <davem@davemloft.net> | 2008-11-19 15:33:54 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-19 15:33:54 -0800 |
commit | b47300168e770b60ab96c8924854c3b0eb4260eb (patch) | |
tree | 8dcdf57ff27c503cf365ae5a98cf30626612b381 /net | |
parent | 566521d63720ab47576afb85147e5652993bf1e6 (diff) | |
download | linux-b47300168e770b60ab96c8924854c3b0eb4260eb.tar.gz linux-b47300168e770b60ab96c8924854c3b0eb4260eb.tar.bz2 linux-b47300168e770b60ab96c8924854c3b0eb4260eb.zip |
net: Do not fire linkwatch events until the device is registered.
Several device drivers try to do things like netif_carrier_off()
before register_netdev() is invoked. This is bogus, but too many
drivers do this to fix them all up in one go.
Reported-by: Folkert van Heusden <folkert@vanheusden.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/sched/sch_generic.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 93cd30ce6501..cdcd16fcfeda 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -270,6 +270,8 @@ static void dev_watchdog_down(struct net_device *dev) void netif_carrier_on(struct net_device *dev) { if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state)) { + if (dev->reg_state == NETREG_UNINITIALIZED) + return; linkwatch_fire_event(dev); if (netif_running(dev)) __netdev_watchdog_up(dev); @@ -285,8 +287,11 @@ EXPORT_SYMBOL(netif_carrier_on); */ void netif_carrier_off(struct net_device *dev) { - if (!test_and_set_bit(__LINK_STATE_NOCARRIER, &dev->state)) + if (!test_and_set_bit(__LINK_STATE_NOCARRIER, &dev->state)) { + if (dev->reg_state == NETREG_UNINITIALIZED) + return; linkwatch_fire_event(dev); + } } EXPORT_SYMBOL(netif_carrier_off); |