Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb xhci(4): After attach, access to sc_child/2 requ...



details:   https://anonhg.NetBSD.org/src/rev/d4600c6f8d5e
branches:  trunk
changeset: 370054:d4600c6f8d5e
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Sep 13 10:33:37 2022 +0000

description:
xhci(4): After attach, access to sc_child/2 requires sc_intr_lock.

Serializes access with xhci_intr.

XXX Need to ensure the interrupt handler is quiesced at this point or
else it will trip over the assertion in xhci_intr about having at
least one child.

diffstat:

 sys/dev/usb/xhci.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 301abdc9b493 -r d4600c6f8d5e sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Tue Sep 13 10:32:58 2022 +0000
+++ b/sys/dev/usb/xhci.c        Tue Sep 13 10:33:37 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.170 2022/09/13 10:15:28 riastradh Exp $     */
+/*     $NetBSD: xhci.c,v 1.171 2022/09/13 10:33:37 riastradh Exp $     */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.170 2022/09/13 10:15:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.171 2022/09/13 10:33:37 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -605,11 +605,13 @@
 {
        struct xhci_softc * const sc = device_private(self);
 
+       mutex_enter(&sc->sc_intr_lock);
        KASSERT((sc->sc_child == child) || (sc->sc_child2 == child));
        if (child == sc->sc_child2)
                sc->sc_child2 = NULL;
        else if (child == sc->sc_child)
                sc->sc_child = NULL;
+       mutex_exit(&sc->sc_intr_lock);
 }
 
 int



Home | Main Index | Thread Index | Old Index