Module Name: src
Committed By: rin
Date: Sun Feb 17 04:17:31 UTC 2019
Modified Files:
src/sys/dev/usb: usbdi.c
Log Message:
Fix system freeze when USB NICs with multiple outstanding transfers
are detached from xhci(4) or ehci(4), that enable up_serialise for
bulk transfers.
The cause of problem is that usbd_ar_pipe() waits xfers of
USBD_NOT_STARTED to be removed, although underlying upm_abort
functions do not remove such queues, as reported by "sc dying".
Therefore, remove xfers of USBD_NOT_STARTED when pipe is closed.
Patch provided by Nick Hudson.
To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/sys/dev/usb/usbdi.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/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.181 src/sys/dev/usb/usbdi.c:1.182
--- src/sys/dev/usb/usbdi.c:1.181 Thu Jan 10 22:13:07 2019
+++ src/sys/dev/usb/usbdi.c Sun Feb 17 04:17:31 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.181 2019/01/10 22:13:07 skrll Exp $ */
+/* $NetBSD: usbdi.c,v 1.182 2019/02/17 04:17:31 rin Exp $ */
/*
* Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.181 2019/01/10 22:13:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.182 2019/02/17 04:17:31 rin Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -884,9 +884,13 @@ usbd_ar_pipe(struct usbd_pipe *pipe)
USBHIST_LOG(usbdebug, "pipe = %#jx xfer = %#jx "
"(methods = %#jx)", (uintptr_t)pipe, (uintptr_t)xfer,
(uintptr_t)pipe->up_methods, 0);
- /* Make the HC abort it (and invoke the callback). */
- pipe->up_methods->upm_abort(xfer);
- /* XXX only for non-0 usbd_clear_endpoint_stall(pipe); */
+ if (xfer->ux_status == USBD_NOT_STARTED) {
+ SIMPLEQ_REMOVE_HEAD(&pipe->up_queue, ux_next);
+ } else {
+ /* Make the HC abort it (and invoke the callback). */
+ pipe->up_methods->upm_abort(xfer);
+ /* XXX only for non-0 usbd_clear_endpoint_stall(pipe); */
+ }
}
pipe->up_aborting = 0;
return USBD_NORMAL_COMPLETION;