summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakemsr <jakemsr@openbsd.org>2007-07-18 18:34:32 +0000
committerjakemsr <jakemsr@openbsd.org>2007-07-18 18:34:32 +0000
commit57ba0d10b3dce78ea3e7ee2e950edf0a729f4df4 (patch)
tree9ead19f3460741f3296172abff0172cd28e5a711
parentconvert code under #if 0 to the new ieee80211_key structure. (diff)
downloadwireguard-openbsd-57ba0d10b3dce78ea3e7ee2e950edf0a729f4df4.tar.xz
wireguard-openbsd-57ba0d10b3dce78ea3e7ee2e950edf0a729f4df4.zip
move the processing of the pause attribute to the end of audiosetinfo(),
to allow buffer sizes and pointer to the buffer to be set to reasonable values for the sample size of the data to be read/written. fixes kernel corruption seen with azalia and probably other drivers that are using something other than 8kHz monaural mulaw as the default encoding when doing 'dd if=/dev/audio of=foo' as the first audio operation after boot. problem reported by deanna@
-rw-r--r--sys/dev/audio.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 02eb1c213b3..3bc8299ddc8 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio.c,v 1.66 2007/07/17 22:59:19 jakemsr Exp $ */
+/* $OpenBSD: audio.c,v 1.67 2007/07/18 18:34:32 jakemsr Exp $ */
/* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */
/*
@@ -2611,27 +2611,6 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
return(error);
}
- if (p->pause != (u_char)~0) {
- sc->sc_pr.pause = p->pause;
- if (!p->pause && !sc->sc_pbus && (sc->sc_mode & AUMODE_PLAY)) {
- s = splaudio();
- error = audiostartp(sc);
- splx(s);
- if (error)
- return error;
- }
- }
- if (r->pause != (u_char)~0) {
- sc->sc_rr.pause = r->pause;
- if (!r->pause && !sc->sc_rbus && (sc->sc_mode & AUMODE_RECORD)) {
- s = splaudio();
- error = audiostartr(sc);
- splx(s);
- if (error)
- return error;
- }
- }
-
if (ai->blocksize != ~0) {
/* Block size specified explicitly. */
if (!cleared)
@@ -2708,6 +2687,27 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
sc->sc_pr.usedlow = sc->sc_pr.usedhigh - sc->sc_pr.blksize;
}
+ if (p->pause != (u_char)~0) {
+ sc->sc_pr.pause = p->pause;
+ if (!p->pause && !sc->sc_pbus && (sc->sc_mode & AUMODE_PLAY)) {
+ s = splaudio();
+ error = audiostartp(sc);
+ splx(s);
+ if (error)
+ return error;
+ }
+ }
+ if (r->pause != (u_char)~0) {
+ sc->sc_rr.pause = r->pause;
+ if (!r->pause && !sc->sc_rbus && (sc->sc_mode & AUMODE_RECORD)) {
+ s = splaudio();
+ error = audiostartr(sc);
+ splx(s);
+ if (error)
+ return error;
+ }
+ }
+
return (0);
}