Module Name:    src
Committed By:   mrg
Date:           Mon Jul 13 05:43:38 UTC 2020

Modified Files:
        src/sys/dev/usb: usbdi.c

Log Message:
for both usbd_transfer() and usbd_ar_pipe() be sure to reset the
xfer ux_state to XFER_BUSY when removing from the queue.

seems to fix an occasional panic i was seeing on pinebook and
pinebookpro lately with axen(4).

from riastradh@.

XXX: pullup-9.


To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 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.202 src/sys/dev/usb/usbdi.c:1.203
--- src/sys/dev/usb/usbdi.c:1.202	Tue May 19 18:32:35 2020
+++ src/sys/dev/usb/usbdi.c	Mon Jul 13 05:43:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.202 2020/05/19 18:32:35 jakllsch Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.203 2020/07/13 05:43:38 mrg 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.202 2020/05/19 18:32:35 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.203 2020/07/13 05:43:38 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -400,6 +400,9 @@ usbd_transfer(struct usbd_xfer *xfer)
 		    err, 0, 0, 0);
 		usbd_lock_pipe(pipe);
 		SDT_PROBE1(usb, device, xfer, preabort,  xfer);
+#ifdef DIAGNOSTIC
+		xfer->ux_state = XFER_BUSY;
+#endif
 		SIMPLEQ_REMOVE_HEAD(&pipe->up_queue, ux_next);
 		if (pipe->up_serialise)
 			usbd_start_next(pipe);
@@ -965,6 +968,9 @@ usbd_ar_pipe(struct usbd_pipe *pipe)
 		    (uintptr_t)pipe->up_methods, 0);
 		if (xfer->ux_status == USBD_NOT_STARTED) {
 			SDT_PROBE1(usb, device, xfer, preabort,  xfer);
+#ifdef DIAGNOSTIC
+			xfer->ux_state = XFER_BUSY;
+#endif
 			SIMPLEQ_REMOVE_HEAD(&pipe->up_queue, ux_next);
 		} else {
 			/* Make the HC abort it (and invoke the callback). */

Reply via email to