git: 954001a9dd36 - main - snd_uaudio: Initialize mixer_lock with MTX_RECURSE

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Tue, 14 Jul 2026 21:17:08 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=954001a9dd363da9184706657eb34f9622bb220f

commit 954001a9dd363da9184706657eb34f9622bb220f
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-07-11 12:57:35 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-07-14 21:16:28 +0000

    snd_uaudio: Initialize mixer_lock with MTX_RECURSE
    
    Fixes:          fc9dc8482396 ("snd_uaudio: Lock usbd_transfer_start() in uaudio_mixer_ctl_set()")
    PR:             296682
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/dev/sound/usb/uaudio.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index 4072c8138cea..4cdd20315258 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -5435,7 +5435,14 @@ uaudio_mixer_init_sub(struct uaudio_softc *sc, struct snd_mixer *m)
 
 	DPRINTF("child=%u\n", i);
 
-	mtx_init(&sc->sc_child[i].mixer_lock, "uaudio mixer lock", NULL, MTX_DEF);
+	/*
+	 * Initialize the mutex with MTX_RECURSE so that functions like
+	 * uaudio_mixer_ctl_set() do not panic when they recurse on the lock,
+	 * as a result of a callback function (e.g., uaudio_hid_rx_callback())
+	 * also having acquired it.
+	 */
+	mtx_init(&sc->sc_child[i].mixer_lock, "uaudio mixer lock", NULL,
+	    MTX_RECURSE);
 	sc->sc_child[i].mixer_dev = m;
 
 	if (i == 0 &&