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(9): Avoid ether_mediachange if stopped.



details:   https://anonhg.NetBSD.org/src/rev/1a6edb7b1ecc
branches:  trunk
changeset: 369493:1a6edb7b1ecc
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Aug 20 12:28:25 2022 +0000

description:
usbnet(9): Avoid ether_mediachange if stopped.

We are called without IFNET_LOCK held here, so touching ifp->if_flags
is forbidden, but that's the first thing ether_mediachange does.

XXX not right either, need to eliminate the check from
ether_mediachange

diffstat:

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

diffs (27 lines):

diff -r e3b869d3bed5 -r 1a6edb7b1ecc sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Sat Aug 20 11:42:49 2022 +0000
+++ b/sys/dev/usb/usbnet.c      Sat Aug 20 12:28:25 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbnet.c,v 1.97 2022/08/16 00:44:20 riastradh Exp $    */
+/*     $NetBSD: usbnet.c,v 1.98 2022/08/20 12:28:25 riastradh Exp $    */
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.97 2022/08/16 00:44:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.98 2022/08/20 12:28:25 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -986,6 +986,8 @@
                        mii_phy_reset(miisc);
        }
 
+       if (unp->unp_stopping)
+               return 0;
        return ether_mediachange(ifp);
 }
 



Home | Main Index | Thread Index | Old Index