Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/audio Avoid a dead lock in audiodetach, since rev 1.63.



details:   https://anonhg.NetBSD.org/src/rev/27bf02ae7ea9
branches:  trunk
changeset: 947199:27bf02ae7ea9
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sun Dec 13 05:29:19 2020 +0000

description:
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:

 sys/dev/audio/audio.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 53e75be72968 -r 27bf02ae7ea9 sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Sun Dec 13 05:21:12 2020 +0000
+++ b/sys/dev/audio/audio.c     Sun Dec 13 05:29:19 2020 +0000
@@ -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 @@
         * 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 @@
        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));



Home | Main Index | Thread Index | Old Index