summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uhub.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2014-05-28 11:20:55 +0000
committermpi <mpi@openbsd.org>2014-05-28 11:20:55 +0000
commitd7fb47546222cf4514e93c2ab60a85be97c2b540 (patch)
tree6e0e5f2c787f5358d97ccc8088fae2650a938b3c /sys/dev/usb/uhub.c
parentremove an errant semicolon. (diff)
downloadwireguard-openbsd-d7fb47546222cf4514e93c2ab60a85be97c2b540.tar.xz
wireguard-openbsd-d7fb47546222cf4514e93c2ab60a85be97c2b540.zip
Apart from the early exploration done to find a console keyboard during
the boot process, USB devices must be attached or detached from the usb task thread in order to avoid races with periodical explorations issued by uhub(4) interrupts. Respect this rule when detaching root hubs during a suspend/resume cycle and avoid some hangs due to the aforementioned race. Tested by Mattieu Baptiste, thanks!
Diffstat (limited to 'sys/dev/usb/uhub.c')
-rw-r--r--sys/dev/usb/uhub.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index 2ef5e6f8d9e..b5974247a7f 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhub.c,v 1.66 2014/03/11 10:24:42 mpi Exp $ */
+/* $OpenBSD: uhub.c,v 1.67 2014/05/28 11:20:55 mpi Exp $ */
/* $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
@@ -546,6 +546,9 @@ uhub_intr(struct usbd_xfer *xfer, void *addr, usbd_status status)
{
struct uhub_softc *sc = addr;
+ if (usbd_is_dying(sc->sc_hub))
+ return;
+
DPRINTF("%s: intr status=%d\n", sc->sc_dev.dv_xname, status);
if (status == USBD_STALLED)
usbd_clear_endpoint_stall_async(sc->sc_ipipe);