Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Don't hold softc lock when calling ucom_read
details: https://anonhg.NetBSD.org/src/rev/ae2704ad8886
branches: trunk
changeset: 349556:ae2704ad8886
user: skrll <skrll%NetBSD.org@localhost>
date: Wed Dec 14 15:11:29 2016 +0000
description:
Don't hold softc lock when calling ucom_read
PR/51714: uftdi (on xhci): mutex_vector_enter: locking against myself
diffstat:
sys/dev/usb/ucom.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diffs (42 lines):
diff -r 2ab564410af5 -r ae2704ad8886 sys/dev/usb/ucom.c
--- a/sys/dev/usb/ucom.c Wed Dec 14 14:01:10 2016 +0000
+++ b/sys/dev/usb/ucom.c Wed Dec 14 15:11:29 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ucom.c,v 1.117 2016/12/04 10:12:35 skrll Exp $ */
+/* $NetBSD: ucom.c,v 1.118 2016/12/14 15:11:29 skrll Exp $ */
/*
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.117 2016/12/04 10:12:35 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.118 2016/12/14 15:11:29 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1608,6 +1608,7 @@
return;
}
+ mutex_exit(&sc->sc_lock);
if (sc->sc_methods->ucom_read != NULL) {
sc->sc_methods->ucom_read(sc->sc_parent, sc->sc_portno,
&cp, &cc);
@@ -1617,6 +1618,15 @@
ub->ub_len = cc;
+ mutex_enter(&sc->sc_lock);
+ if (sc->sc_dying) {
+ if (--sc->sc_refcnt < 0)
+ cv_broadcast(&sc->sc_detachcv);
+ mutex_exit(&sc->sc_lock);
+ DPRINTF("... dying", 0, 0, 0, 0);
+ return;
+ }
+
SIMPLEQ_INSERT_TAIL(&sc->sc_ibuff_full, ub, ub_link);
ucom_read_complete(sc);
Home |
Main Index |
Thread Index |
Old Index