Module Name:    src
Committed By:   martin
Date:           Sat Dec 19 13:54:56 UTC 2020

Modified Files:
        src/sys/dev/audio [netbsd-9]: audio.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #1158):

        sys/dev/audio/audio.c: revision 1.83

Avoid a dead lock in audiodetach, since rev 1.63.
audio_unlink() must be called without exlock held (and
audio_mixer_destroy() must be called with exlock held).

This makes unplugging during playing/recording work (again).

Reported by Julian Coleman on current-users:
 http://mail-index.netbsd.org/current-users/2020/12/10/msg040050.html


To generate a diff of this commit:
cvs rdiff -u -r1.28.2.17 -r1.28.2.18 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.28.2.17 src/sys/dev/audio/audio.c:1.28.2.18
--- src/sys/dev/audio/audio.c:1.28.2.17	Sat Dec 19 13:48:27 2020
+++ src/sys/dev/audio/audio.c	Sat Dec 19 13:54:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.28.2.17 2020/12/19 13:48:27 martin Exp $	*/
+/*	$NetBSD: audio.c,v 1.28.2.18 2020/12/19 13:54:56 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.28.2.17 2020/12/19 13:48:27 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.28.2.18 2020/12/19 13:54:56 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -1324,7 +1324,6 @@ audiodetach(device_t self, int flags)
 	 * that hold sc, and any new calls with files that were for sc will
 	 * fail.  Thus, we now have exclusive access to the softc.
 	 */
-	sc->sc_exlock = 1;
 
 	/*
 	 * Nuke all open instances.
@@ -1350,6 +1349,7 @@ audiodetach(device_t self, int flags)
 	pmf_device_deregister(self);
 
 	/* Free resources */
+	sc->sc_exlock = 1;
 	if (sc->sc_pmixer) {
 		audio_mixer_destroy(sc, sc->sc_pmixer);
 		kmem_free(sc->sc_pmixer, sizeof(*sc->sc_pmixer));

Reply via email to