diff options
author | 2015-01-18 14:40:05 +0000 | |
---|---|---|
committer | 2015-01-18 14:40:05 +0000 | |
commit | ddb6891cd6483277d80be8a6afa3a3305b834b2a (patch) | |
tree | c8fce5cc4b2580fc82cd211974774e33e1413cf0 /sys/dev/usb/umass.c | |
parent | sync (diff) | |
download | wireguard-openbsd-ddb6891cd6483277d80be8a6afa3a3305b834b2a.tar.xz wireguard-openbsd-ddb6891cd6483277d80be8a6afa3a3305b834b2a.zip |
Do not try to free xfers before aborting the pipes, otherwise a clown
might eat you.
Diffstat (limited to 'sys/dev/usb/umass.c')
-rw-r--r-- | sys/dev/usb/umass.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index d4155f68190..11b2a24eb3f 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass.c,v 1.67 2014/08/21 14:52:56 mpi Exp $ */ +/* $OpenBSD: umass.c,v 1.68 2015/01/18 14:40:05 mpi Exp $ */ /* $NetBSD: umass.c,v 1.116 2004/06/30 05:53:46 mycroft Exp $ */ /* @@ -671,13 +671,6 @@ umass_disco(struct umass_softc *sc) DPRINTF(UDMASS_GEN, ("umass_disco\n")); - /* Free the xfers. */ - for (i = 0; i < XFER_NR; i++) - if (sc->transfer_xfer[i] != NULL) { - usbd_free_xfer(sc->transfer_xfer[i]); - sc->transfer_xfer[i] = NULL; - } - /* Remove all the pipes. */ for (i = 0 ; i < UMASS_NEP ; i++) { if (sc->sc_pipe[i] != NULL) { @@ -685,6 +678,17 @@ umass_disco(struct umass_softc *sc) sc->sc_pipe[i] = NULL; } } + + /* Make sure there is no stuck control transfer left. */ + usbd_abort_pipe(sc->sc_udev->default_pipe); + + /* Free the xfers. */ + for (i = 0; i < XFER_NR; i++) { + if (sc->transfer_xfer[i] != NULL) { + usbd_free_xfer(sc->transfer_xfer[i]); + sc->transfer_xfer[i] = NULL; + } + } } /* |