Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb In the error paths where uaudio_chan_free_buffer...



details:   https://anonhg.NetBSD.org/src/rev/6a7dc252981f
branches:  trunk
changeset: 789328:6a7dc252981f
user:      aymeric <aymeric%NetBSD.org@localhost>
date:      Thu Aug 15 15:26:50 2013 +0000

description:
In the error paths where uaudio_chan_free_buffers() has to be called, acquire
the uaudio spinlock after the call because another spinlock is used indirectly
during the call.
Fixes a panic with LOCKDEBUG when a low-speed uaudio attached to a high-speed
hub is opened.

diffstat:

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

diffs (40 lines):

diff -r 8980ca662bc0 -r 6a7dc252981f sys/dev/usb/uaudio.c
--- a/sys/dev/usb/uaudio.c      Thu Aug 15 12:45:50 2013 +0000
+++ b/sys/dev/usb/uaudio.c      Thu Aug 15 15:26:50 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uaudio.c,v 1.136 2013/05/12 09:54:55 wiz Exp $ */
+/*     $NetBSD: uaudio.c,v 1.137 2013/08/15 15:26:50 aymeric 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.136 2013/05/12 09:54:55 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.137 2013/08/15 15:26:50 aymeric Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2593,9 +2593,9 @@
        }
 
        err = uaudio_chan_open(sc, ch);
-       mutex_spin_enter(&sc->sc_intr_lock);
        if (err) {
                uaudio_chan_free_buffers(sc, ch);
+               mutex_spin_enter(&sc->sc_intr_lock);
                return EIO;
        }
 
@@ -2640,9 +2640,9 @@
        }
 
        err = uaudio_chan_open(sc, ch);
-       mutex_spin_enter(&sc->sc_intr_lock);
        if (err) {
                uaudio_chan_free_buffers(sc, ch);
+               mutex_spin_enter(&sc->sc_intr_lock);
                return EIO;
        }
 



Home | Main Index | Thread Index | Old Index