git: 682a7750f6c0 - stable/15 - snd_uaudio: Do not touch mixer_lock when there is no mixer
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Nov 2026 09:49:02 UTC
The branch stable/15 has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=682a7750f6c07bc367e573fc9fdfa90eb8e5bf9f
commit 682a7750f6c07bc367e573fc9fdfa90eb8e5bf9f
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-11-13 12:48:09 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-11-20 09:45:52 +0000
snd_uaudio: Do not touch mixer_lock when there is no mixer
Using the mixer lock unconditionally panics because the lock is
uninitialized on devices with no audio interfaces, for instance
MIDI-only keyboards.
Fixes: 9a00e0b8ca56 ("snd_uaudio: Do not use snd_mixer->lock as mixer_lock")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D61506
(cherry picked from commit dabd959b17597ad790327020a667ced9a05d7499)
---
sys/dev/sound/usb/uaudio.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index d574c7fbc93f..1c364ce44232 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -1148,7 +1148,11 @@ uaudio_attach(device_t dev)
bus_attach_children(dev);
- if (uaudio_handle_hid) {
+ /*
+ * Gate on mixer_dev, otherwise a device with no audio interfaces, such
+ * as a MIDI-only keyboard, will end up using an uninitialized mutex.
+ */
+ if (uaudio_handle_hid && sc->sc_child[0].mixer_dev != NULL) {
if (uaudio_hid_attach(sc, uaa) == 0) {
device_printf(dev, "HID volume keys found.\n");
} else {
@@ -1157,7 +1161,8 @@ uaudio_attach(device_t dev)
}
/* reload all mixer settings */
- uaudio_mixer_reload_all(sc);
+ if (sc->sc_child[0].mixer_dev != NULL)
+ uaudio_mixer_reload_all(sc);
/* enable S/PDIF output, if any */
if (sc->sc_set_spdif_fn(sc,