Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Fix locking botch. Ensure that sc_lock is still...



details:   https://anonhg.NetBSD.org/src/rev/6b7f0f0878c6
branches:  trunk
changeset: 824017:6b7f0f0878c6
user:      nat <nat%NetBSD.org@localhost>
date:      Fri May 19 04:16:06 2017 +0000

description:
Fix locking botch.  Ensure that sc_lock is still held when exiting
trigger_[input/output].

diffstat:

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

diffs (50 lines):

diff -r dd50d3629339 -r 6b7f0f0878c6 sys/dev/usb/uaudio.c
--- a/sys/dev/usb/uaudio.c      Fri May 19 03:33:31 2017 +0000
+++ b/sys/dev/usb/uaudio.c      Fri May 19 04:16:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uaudio.c,v 1.148 2017/05/16 23:49:43 nat Exp $ */
+/*     $NetBSD: uaudio.c,v 1.149 2017/05/19 04:16:06 nat Exp $ */
 
 /*
  * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.148 2017/05/16 23:49:43 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.149 2017/05/19 04:16:06 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2603,6 +2603,7 @@
        mutex_exit(&sc->sc_lock);
        err = uaudio_chan_open(sc, ch);
        if (err) {
+               mutex_enter(&sc->sc_lock);
                mutex_enter(&sc->sc_intr_lock);
                return EIO;
        }
@@ -2610,6 +2611,7 @@
        err = uaudio_chan_alloc_buffers(sc, ch);
        if (err) {
                uaudio_chan_close(sc, ch);
+               mutex_enter(&sc->sc_lock);
                mutex_enter(&sc->sc_intr_lock);
                return EIO;
        }
@@ -2655,6 +2657,7 @@
        mutex_exit(&sc->sc_lock);
        err = uaudio_chan_open(sc, ch);
        if (err) {
+               mutex_enter(&sc->sc_lock);
                mutex_enter(&sc->sc_intr_lock);
                return EIO;
        }
@@ -2662,6 +2665,7 @@
        err = uaudio_chan_alloc_buffers(sc, ch);
        if (err) {
                uaudio_chan_close(sc, ch);
+               mutex_enter(&sc->sc_lock);
                mutex_enter(&sc->sc_intr_lock);
                return EIO;
        }



Home | Main Index | Thread Index | Old Index