Module Name: src
Committed By: mrg
Date: Mon Jun 24 04:42:06 UTC 2019
Modified Files:
src/sys/dev/usb: if_ure.c
Log Message:
actually set ure_stopping, and don't follow it in init.
pointed out by sc.dying on source-changes-d. thanks.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/if_ure.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/if_ure.c
diff -u src/sys/dev/usb/if_ure.c:1.11 src/sys/dev/usb/if_ure.c:1.12
--- src/sys/dev/usb/if_ure.c:1.11 Sun Jun 23 02:14:14 2019
+++ src/sys/dev/usb/if_ure.c Mon Jun 24 04:42:06 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ure.c,v 1.11 2019/06/23 02:14:14 mrg Exp $ */
+/* $NetBSD: if_ure.c,v 1.12 2019/06/24 04:42:06 mrg Exp $ */
/* $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */
/*-
@@ -30,7 +30,7 @@
/* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.11 2019/06/23 02:14:14 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.12 2019/06/24 04:42:06 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -521,7 +521,7 @@ ure_init_locked(struct ifnet *ifp)
KASSERT(mutex_owned(&sc->ure_lock));
- if (sc->ure_stopping || sc->ure_dying)
+ if (sc->ure_dying)
return EIO;
/* Cancel pending I/O. */
@@ -689,6 +689,13 @@ ure_stop_locked(struct ifnet *ifp, int d
usbd_status err;
int i;
+ KASSERT(mutex_owned(&sc->ure_lock));
+ mutex_enter(&sc->ure_rxlock);
+ mutex_enter(&sc->ure_txlock);
+ sc->ure_stopping = true;
+ mutex_exit(&sc->ure_txlock);
+ mutex_exit(&sc->ure_rxlock);
+
ure_reset(sc);
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);