summaryrefslogtreecommitdiff
path: root/sys/dev/usb/umass.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-01-18 14:40:06 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-01-18 14:40:06 +0000
commitbd4d3fede70171a9a1d2d77189a03efd9063cb4f (patch)
tree51663f072bee6b7ff45399961f2abd02b77c2c27 /sys/dev/usb/umass.c
parent9654ae85bd301cbb8d6153db2384ea83f17387cf (diff)
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.c20
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;
+ }
+ }
}
/*