summaryrefslogtreecommitdiff
path: root/sys/dev/audio
diff options
context:
space:
mode:
authorisaki <isaki@NetBSD.org>2020-12-13 05:29:19 +0000
committerisaki <isaki@NetBSD.org>2020-12-13 05:29:19 +0000
commitc66bce30a35677e19b3f8a6238a87e90742b178f (patch)
tree06ab1933bdd38bd8dc01aacea57de3891e8559cd /sys/dev/audio
parent1f44295abf748612cbd53d69b292f0db9a69af93 (diff)
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
Diffstat (limited to 'sys/dev/audio')
-rw-r--r--sys/dev/audio/audio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/audio/audio.c b/sys/dev/audio/audio.c
index e8960448a8a..b1885abd15b 100644
--- a/sys/dev/audio/audio.c
+++ b/sys/dev/audio/audio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.82 2020/12/13 05:21:12 isaki Exp $ */
+/* $NetBSD: audio.c,v 1.83 2020/12/13 05:29:19 isaki Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.82 2020/12/13 05:21:12 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.83 2020/12/13 05:29:19 isaki Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@@ -1331,7 +1331,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.
@@ -1357,6 +1356,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));