git: c8d1c9474123 - main - snd_dummy: Do not use dummy_chan_io() as mpu401's interrupt handler
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Nov 2026 16:38:06 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=c8d1c94741231d95964b91910880769019478854
commit c8d1c94741231d95964b91910880769019478854
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-11-10 13:02:13 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-11-12 16:35:48 +0000
snd_dummy: Do not use dummy_chan_io() as mpu401's interrupt handler
dummy_chan_io() runs with sc->lock held, but mpu401 calls its handler
from a callout with no mutex associated with it, so writing to the MIDI
device node caused a panic.
Give mpu401 its own handler, and leave MIDI to mpu401's timer instead of
the PCM callout.
Fixes: e963472ef853 ("snd_dummy: Initial MIDI support")
Sponsored by: The FreeBSD Foundation
---
sys/dev/sound/dummy.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/sys/dev/sound/dummy.c b/sys/dev/sound/dummy.c
index afe3c0a59fe0..54c1ae493c01 100644
--- a/sys/dev/sound/dummy.c
+++ b/sys/dev/sound/dummy.c
@@ -98,9 +98,6 @@ dummy_chan_io(void *arg)
struct dummy_chan *ch;
int i = 0;
- if (sc->mpu_intr)
- (sc->mpu_intr)(sc->mpu);
-
if (sc->stopped)
return;
@@ -324,6 +321,15 @@ dummy_mpu_uninit(struct mpu401 *arg, void *cookie)
return (0);
}
+static void
+dummy_mpu_intr(void *arg)
+{
+ struct dummy_softc *sc = arg;
+
+ if (sc->mpu_intr != NULL)
+ (sc->mpu_intr)(sc->mpu);
+}
+
static kobj_method_t dummy_mpu_methods[] = {
KOBJMETHOD(mpufoi_read, dummy_mpu_read),
KOBJMETHOD(mpufoi_write, dummy_mpu_write),
@@ -393,7 +399,7 @@ dummy_attach(device_t dev)
*/
make_dev_alias(sc->info.dsp_dev, "dsp.dummy");
- sc->mpu = mpu401_init(&dummy_mpu_class, sc, dummy_chan_io,
+ sc->mpu = mpu401_init(&dummy_mpu_class, sc, dummy_mpu_intr,
&sc->mpu_intr);
if (sc->mpu == NULL)
return (ENXIO);