Module Name:    src
Committed By:   riastradh
Date:           Sun Oct 10 11:21:05 UTC 2021

Modified Files:
        src/sys/dev/audio: audio.c

Log Message:
audio(9): Issue pserialize_perform outside sc_lock in audiodetach.

Breaks another deadlock between sc_lock and high-priority xcalls at
softint serial.  With any luck, this should be the last such softint
deadlock in audio!


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 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.109 src/sys/dev/audio/audio.c:1.110
--- src/sys/dev/audio/audio.c:1.109	Sun Oct 10 11:20:29 2021
+++ src/sys/dev/audio/audio.c	Sun Oct 10 11:21:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.109 2021/10/10 11:20:29 riastradh Exp $	*/
+/*	$NetBSD: audio.c,v 1.110 2021/10/10 11:21:05 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.109 2021/10/10 11:20:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.110 2021/10/10 11:21:05 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -1322,6 +1322,7 @@ audiodetach(device_t self, int flags)
 	SLIST_FOREACH(file, &sc->sc_files, entry) {
 		atomic_store_relaxed(&file->dying, true);
 	}
+	mutex_exit(sc->sc_lock);
 
 	/*
 	 * Wait for existing users to drain.
@@ -1331,7 +1332,6 @@ audiodetach(device_t self, int flags)
 	 *   be psref_released.
 	 */
 	pserialize_perform(sc->sc_psz);
-	mutex_exit(sc->sc_lock);
 	psref_target_destroy(&sc->sc_psref, audio_psref_class);
 
 	/*

Reply via email to