summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2018-09-06 15:39:49 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2018-09-06 15:39:49 +0000
commit34e6983c0328b2fe5fce992dfc159e81cc5910ff (patch)
treef7da3fc9db18bebc8a51e5499cbbadd70b1967f6 /sys/dev
parent4306d1a3aa4d3f9b158a3946a0960a889ba668f9 (diff)
If we cannot stop the endpoint when aborting a transfer assume that
the device is gone and give back the descriptor to the stack. Without this usbd_abort_pipe() could end up in an infinite loop. Issue reported by Tom Murphy.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/xhci.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c
index d326a1f0199..7209e2062ba 100644
--- a/sys/dev/usb/xhci.c
+++ b/sys/dev/usb/xhci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xhci.c,v 1.88 2018/09/05 14:03:28 mpi Exp $ */
+/* $OpenBSD: xhci.c,v 1.89 2018/09/06 15:39:48 mpi Exp $ */
/*
* Copyright (c) 2014-2015 Martin Pieuchot
@@ -2055,8 +2055,13 @@ xhci_abort_xfer(struct usbd_xfer *xfer, usbd_status status)
xp->aborted_xfer = xfer;
/* Stop the endpoint and wait until the hardware says so. */
- if (xhci_cmd_stop_ep(sc, xp->slot, xp->dci))
+ if (xhci_cmd_stop_ep(sc, xp->slot, xp->dci)) {
DPRINTF(("%s: error stopping endpoint\n", DEVNAME(sc)));
+ /* Assume the device is gone. */
+ xfer->status = status;
+ usb_transfer_complete(xfer);
+ return;
+ }
/*
* The transfer was already completed when we stopped the