Module Name:    src
Committed By:   riastradh
Date:           Sat Jul  9 16:01:31 UTC 2011

Modified Files:
        src/sys/dev/pci/hdaudio: hdaudio.c

Log Message:
Release mutex before unmapping DMA memory.

Fixes a LOCKDEBUG panic triggered by `hdaudioctl set'.

ok jmcneill


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/hdaudio/hdaudio.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/pci/hdaudio/hdaudio.c
diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.11 src/sys/dev/pci/hdaudio/hdaudio.c:1.12
--- src/sys/dev/pci/hdaudio/hdaudio.c:1.11	Sun Feb 13 17:49:12 2011
+++ src/sys/dev/pci/hdaudio/hdaudio.c	Sat Jul  9 16:01:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.11 2011/02/13 17:49:12 jmcneill Exp $ */
+/* $NetBSD: hdaudio.c,v 1.12 2011/07/09 16:01:31 riastradh Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <[email protected]>
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.11 2011/02/13 17:49:12 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.12 2011/07/09 16:01:31 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1034,6 +1034,7 @@
 hdaudio_stream_disestablish(struct hdaudio_stream *st)
 {
 	struct hdaudio_softc *sc = st->st_host;
+	struct hdaudio_dma dma;
 
 	KASSERT(sc->sc_stream_mask & (1 << st->st_shift));
 
@@ -1041,8 +1042,12 @@
 	sc->sc_stream_mask &= ~(1 << st->st_shift);
 	st->st_intr = NULL;
 	st->st_cookie = NULL;
-	hdaudio_dma_free(sc, &st->st_bdl);
+	dma = st->st_bdl;
+	st->st_bdl.dma_valid = false;
 	mutex_exit(&sc->sc_stream_mtx);
+
+	/* Can't bus_dmamem_unmap while holding a mutex.  */
+	hdaudio_dma_free(sc, &dma);
 }
 
 /*

Reply via email to