aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Margiolis <christos@FreeBSD.org>2026-07-11 12:57:35 +0000
committerChristos Margiolis <christos@FreeBSD.org>2026-07-14 21:16:28 +0000
commit954001a9dd363da9184706657eb34f9622bb220f (patch)
tree188eece9dcb68cebb85311b41422229eba6e77ce
parent40cc9de950f7e6ba2049467fa05c46b9161f49a5 (diff)
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
-rw-r--r--sys/dev/sound/usb/uaudio.c9
1 files changed, 8 insertions, 1 deletions
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 &&