mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									566521d637
								
							
						
					
					
						commit
						b47300168e
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue