Module Name:    src
Committed By:   riastradh
Date:           Tue Sep 13 10:33:37 UTC 2022

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

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/dev/usb/xhci.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.170 src/sys/dev/usb/xhci.c:1.171
--- src/sys/dev/usb/xhci.c:1.170	Tue Sep 13 10:15:28 2022
+++ src/sys/dev/usb/xhci.c	Tue Sep 13 10:33:37 2022
@@ -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 @@ xhci_childdet(device_t self, device_t ch
 {
 	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

Reply via email to