Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Nothing guarantees xfer's timeout has completed.
details: https://anonhg.NetBSD.org/src/rev/1bc6ee8e0178
branches: trunk
changeset: 1007265:1bc6ee8e0178
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Feb 12 15:59:59 2020 +0000
description:
Nothing guarantees xfer's timeout has completed.
Wait for it when we free the xfer.
diffstat:
sys/dev/usb/usbdi.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diffs (39 lines):
diff -r 7489143e8da9 -r 1bc6ee8e0178 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c Wed Feb 12 15:59:44 2020 +0000
+++ b/sys/dev/usb/usbdi.c Wed Feb 12 15:59:59 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.189 2020/02/08 07:57:16 maxv Exp $ */
+/* $NetBSD: usbdi.c,v 1.190 2020/02/12 15:59:59 riastradh 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.189 2020/02/08 07:57:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.190 2020/02/12 15:59:59 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -491,12 +491,14 @@
if (xfer->ux_buf) {
usbd_free_buffer(xfer);
}
-#if defined(DIAGNOSTIC)
- if (callout_pending(&xfer->ux_callout)) {
- callout_stop(&xfer->ux_callout);
- printf("usbd_free_xfer: timeout_handle pending\n");
- }
-#endif
+
+ /* Wait for any straggling timeout to complete. */
+ mutex_enter(xfer->ux_bus->ub_lock);
+ callout_halt(&xfer->ux_callout, xfer->ux_bus->ub_lock);
+ usb_rem_task_wait(xfer->ux_pipe->up_dev, &xfer->ux_aborttask,
+ USB_TASKQ_HC, xfer->ux_bus->ub_lock);
+ mutex_exit(xfer->ux_bus->ub_lock);
+
cv_destroy(&xfer->ux_cv);
xfer->ux_bus->ub_methods->ubm_freex(xfer->ux_bus, xfer);
return USBD_NORMAL_COMPLETION;
Home |
Main Index |
Thread Index |
Old Index