Module Name:    src
Committed By:   riastradh
Date:           Thu Mar  3 05:49:15 UTC 2022

Modified Files:
        src/sys/dev/usb: usbnet.c

Log Message:
usbnet: Uncomment and fix assertion for ifp->if_flags |= IFF_RUNNING.

We always hold IFNET_LOCK for ioctls that end up here -- the ones
that don't hold it are only SIOCADDMULTI/SIOCDELMULTI, which don't
end up here.  However, urndis(4) throws a spanner in the works by
doing weird device initialization.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/usb/usbnet.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.62 src/sys/dev/usb/usbnet.c:1.63
--- src/sys/dev/usb/usbnet.c:1.62	Thu Mar  3 05:49:07 2022
+++ src/sys/dev/usb/usbnet.c	Thu Mar  3 05:49:14 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.62 2022/03/03 05:49:07 riastradh Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.63 2022/03/03 05:49:14 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.62 2022/03/03 05:49:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.63 2022/03/03 05:49:14 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -855,10 +855,9 @@ usbnet_init_rx_tx(struct usbnet * const 
 	}
 
 	/* Indicate we are up and running. */
-#if 0
-	/* XXX if_mcast_op() can call this without ifnet locked */
-	KASSERT(ifp->if_softc == NULL || IFNET_LOCKED(ifp));
-#endif
+	/* XXX urndis calls usbnet_init_rx_tx before usbnet_attach_ifp.  */
+	KASSERTMSG(!unp->unp_ifp_attached || IFNET_LOCKED(ifp),
+	    "%s", ifp->if_xname);
 	ifp->if_flags |= IFF_RUNNING;
 
 	/* Start up the receive pipe(s). */

Reply via email to