On Tue, Dec 03, 2019 at 05:01:45AM +0000, Taylor R Campbell wrote:
> Module Name:  src
> Committed By: riastradh
> Date:         Tue Dec  3 05:01:45 UTC 2019
> 
> Modified Files:
>       src/sys/dev/usb: usbnet.c
> 
> Log Message:
> Fix order of nulling un->un_pri->unp_ec.ec_mii.
> 
> Can't null it until after if_detach prevents further use.
> 
> While here, fix conditionals in usbnet_tick_task to use the unp_dying
> flag, not the nullness of mii (or of ifp, which never null because
> it's an embedded member).
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.30 -r1.31 src/sys/dev/usb/usbnet.c

This breaks urndis(4). See http://gnats.netbsd.org/54762
The following diff restores it to work.

Index: usbnet.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbnet.c,v
retrieving revision 1.32
diff -u -r1.32 usbnet.c
--- usbnet.c    3 Dec 2019 05:01:58 -0000       1.32
+++ usbnet.c    14 Dec 2019 14:34:45 -0000
@@ -1197,9 +1197,11 @@
                usbnet_watchdog(ifp);
 
        DPRINTFN(8, "mii %jx ifp %jx", (uintptr_t)mii, (uintptr_t)ifp, 0, 0);
-       mii_tick(mii);
-       if (!unp->unp_link)
-               (*mii->mii_statchg)(ifp);
+       if (mii) {
+               mii_tick(mii);
+               if (!unp->unp_link)
+                       (*mii->mii_statchg)(ifp);
+       }
 
        /* Call driver if requested. */
        uno_tick(un);

Reply via email to