소스 검색

usb gadget: cdc ethernet notification bugfix

Bugfix for the new CDC Ethernet code:  as part of activating the
network interface's USB link, make sure its link management code
knows whether the interface is open or not.

Without this fix, the link won't work right when it's brought up
before the link is active ... because the initial notification it
sends will have the wrong link state (down, not up).  Makes it
hard to bridge these links (on the host side), among other things.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: stable <stable@kernel.org> [2.6.27]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
David Brownell 17 년 전
부모
커밋
29bac7b766
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      drivers/usb/gadget/u_ether.c

+ 7 - 0
drivers/usb/gadget/u_ether.c

@@ -873,6 +873,13 @@ struct net_device *gether_connect(struct gether *link)
 		spin_lock(&dev->lock);
 		spin_lock(&dev->lock);
 		dev->port_usb = link;
 		dev->port_usb = link;
 		link->ioport = dev;
 		link->ioport = dev;
+		if (netif_running(dev->net)) {
+			if (link->open)
+				link->open(link);
+		} else {
+			if (link->close)
+				link->close(link);
+		}
 		spin_unlock(&dev->lock);
 		spin_unlock(&dev->lock);
 
 
 		netif_carrier_on(dev->net);
 		netif_carrier_on(dev->net);