Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Ensure the softc lock is not held in ucom_shutdo...



details:   https://anonhg.NetBSD.org/src/rev/62528f6d69a0
branches:  trunk
changeset: 349201:62528f6d69a0
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Nov 29 07:26:53 2016 +0000

description:
Ensure the softc lock is not held in ucom_shutdown as the call to ucom_dtr
can sleep.

diffstat:

 sys/dev/usb/ucom.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r d2d295062f7c -r 62528f6d69a0 sys/dev/usb/ucom.c
--- a/sys/dev/usb/ucom.c        Tue Nov 29 03:23:00 2016 +0000
+++ b/sys/dev/usb/ucom.c        Tue Nov 29 07:26:53 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ucom.c,v 1.115 2016/11/19 09:49:20 skrll Exp $ */
+/*     $NetBSD: ucom.c,v 1.116 2016/11/29 07:26:53 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.115 2016/11/19 09:49:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.116 2016/11/29 07:26:53 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -523,7 +523,6 @@
 
        UCOMHIST_FUNC(); UCOMHIST_CALLED();
 
-       KASSERT(mutex_owned(&sc->sc_lock));
        /*
         * Hang up if necessary.  Wait a bit, so the other side has time to
         * notice even if we immediately open the port again.
@@ -531,7 +530,7 @@
        if (ISSET(tp->t_cflag, HUPCL)) {
                ucom_dtr(sc, 0);
                /* XXX will only timeout */
-               (void) kpause(ttclos, false, hz, &sc->sc_lock);
+               (void) kpause(ttclos, false, hz, NULL);
        }
 }
 
@@ -1644,9 +1643,9 @@
                return;
        }
 
-       ucom_shutdown(sc);
+       mutex_exit(&sc->sc_lock);
 
-       mutex_exit(&sc->sc_lock);
+       ucom_shutdown(sc);
 
        if (sc->sc_bulkin_pipe != NULL) {
                usbd_abort_pipe(sc->sc_bulkin_pipe);



Home | Main Index | Thread Index | Old Index