Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb usbnet: Uncomment and fix assertion for ifp->if_...



details:   https://anonhg.NetBSD.org/src/rev/052d5ff7d21b
branches:  trunk
changeset: 362502:052d5ff7d21b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:49:14 2022 +0000

description:
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.

diffstat:

 sys/dev/usb/usbnet.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (32 lines):

diff -r e0b324e2b5c9 -r 052d5ff7d21b sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Thu Mar 03 05:49:07 2022 +0000
+++ b/sys/dev/usb/usbnet.c      Thu Mar 03 05:49:14 2022 +0000
@@ -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 @@
        }
 
        /* 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). */



Home | Main Index | Thread Index | Old Index