Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys usb: Omit bogus assertions about struct usbd_pipe::up_in...



details:   https://anonhg.NetBSD.org/src/rev/f2c6231ffba3
branches:  trunk
changeset: 958058:f2c6231ffba3
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Dec 22 01:07:23 2020 +0000

description:
usb: Omit bogus assertions about struct usbd_pipe::up_intrxfer.

These assertions were only valid for pipes at UE_IN_DIR, UE_INTERRUPT
endpoints created with usbd_open_pipe_intr, which uses up_intrxfer to
pass the struct usbd_xfer object to usbd_close_pipe to free later.

In contrast, for pipes at UE_OUT_DIR, UE_INTERRUPT endpoints,
up_intrxfer is never initialized, so the assertion cannot be right.
In principle we might even have more than one outstanding interrupt
transfer at a time, rendering the point of the assertion moot anyway.

Found by interrupting a uhidev write to a u2f device.

ok nick

diffstat:

 sys/dev/usb/ehci.c           |  5 ++---
 sys/dev/usb/ohci.c           |  5 ++---
 sys/dev/usb/uhci.c           |  5 ++---
 sys/dev/usb/xhci.c           |  5 ++---
 sys/external/bsd/dwc2/dwc2.c |  5 ++---
 5 files changed, 10 insertions(+), 15 deletions(-)

diffs (130 lines):

diff -r e5aa3d906c32 -r f2c6231ffba3 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Mon Dec 21 21:04:18 2020 +0000
+++ b/sys/dev/usb/ehci.c        Tue Dec 22 01:07:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.283 2020/11/30 05:33:32 msaitoh Exp $ */
+/*     $NetBSD: ehci.c,v 1.284 2020/12/22 01:07:23 riastradh Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.283 2020/11/30 05:33:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.284 2020/12/22 01:07:23 riastradh Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -4138,7 +4138,6 @@
        EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
        DPRINTF("xfer=%#jx", (uintptr_t)xfer, 0, 0, 0);
-       KASSERT(xfer->ux_pipe->up_intrxfer == xfer);
 
        /*
         * XXX - abort_xfer uses ehci_sync_hc, which syncs via the advance
diff -r e5aa3d906c32 -r f2c6231ffba3 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Mon Dec 21 21:04:18 2020 +0000
+++ b/sys/dev/usb/ohci.c        Tue Dec 22 01:07:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.313 2020/12/10 20:50:24 skrll Exp $ */
+/*     $NetBSD: ohci.c,v 1.314 2020/12/22 01:07:23 riastradh Exp $     */
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.313 2020/12/10 20:50:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.314 2020/12/22 01:07:23 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -3384,7 +3384,6 @@
        ohci_softc_t *sc __diagused = OHCI_XFER2SC(xfer);
 
        KASSERT(mutex_owned(&sc->sc_lock));
-       KASSERT(xfer->ux_pipe->up_intrxfer == xfer);
 
        usbd_xfer_abort(xfer);
 }
diff -r e5aa3d906c32 -r f2c6231ffba3 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Mon Dec 21 21:04:18 2020 +0000
+++ b/sys/dev/usb/uhci.c        Tue Dec 22 01:07:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.304 2020/07/07 10:02:17 skrll Exp $ */
+/*     $NetBSD: uhci.c,v 1.305 2020/12/22 01:07:23 riastradh Exp $     */
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012, 2016, 2020 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.304 2020/07/07 10:02:17 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.305 2020/12/22 01:07:23 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2836,7 +2836,6 @@
        uhci_softc_t *sc __diagused = UHCI_XFER2SC(xfer);
 
        KASSERT(mutex_owned(&sc->sc_lock));
-       KASSERT(xfer->ux_pipe->up_intrxfer == xfer);
 
        UHCIHIST_FUNC(); UHCIHIST_CALLED();
        DPRINTF("xfer=%#jx", (uintptr_t)xfer, 0, 0, 0);
diff -r e5aa3d906c32 -r f2c6231ffba3 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Mon Dec 21 21:04:18 2020 +0000
+++ b/sys/dev/usb/xhci.c        Tue Dec 22 01:07:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.135 2020/10/15 09:37:40 jmcneill Exp $      */
+/*     $NetBSD: xhci.c,v 1.136 2020/12/22 01:07:23 riastradh Exp $     */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.135 2020/10/15 09:37:40 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.136 2020/12/22 01:07:23 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -4412,7 +4412,6 @@
        XHCIHIST_CALLARGS("%#jx", (uintptr_t)xfer, 0, 0, 0);
 
        KASSERT(mutex_owned(&sc->sc_lock));
-       KASSERT(xfer->ux_pipe->up_intrxfer == xfer);
        usbd_xfer_abort(xfer);
 }
 
diff -r e5aa3d906c32 -r f2c6231ffba3 sys/external/bsd/dwc2/dwc2.c
--- a/sys/external/bsd/dwc2/dwc2.c      Mon Dec 21 21:04:18 2020 +0000
+++ b/sys/external/bsd/dwc2/dwc2.c      Tue Dec 22 01:07:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2.c,v 1.74 2020/05/15 06:15:42 skrll Exp $  */
+/*     $NetBSD: dwc2.c,v 1.75 2020/12/22 01:07:23 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.74 2020/05/15 06:15:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.75 2020/12/22 01:07:23 riastradh Exp $");
 
 #include "opt_usb.h"
 
@@ -880,7 +880,6 @@
        struct dwc2_softc *sc __diagused = DWC2_XFER2SC(xfer);
 
        KASSERT(mutex_owned(&sc->sc_lock));
-       KASSERT(xfer->ux_pipe->up_intrxfer == xfer);
 
        DPRINTF("xfer=%p\n", xfer);
        usbd_xfer_abort(xfer);



Home | Main Index | Thread Index | Old Index