git: 0cb05a9270ac - main - snd_maestro3: Do not hold sc_lock across the hwvol handlers

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Wed, 18 Nov 2026 10:24:35 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=0cb05a9270ac06a5eef7d3cca9c1ddb3247bf63f

commit 0cb05a9270ac06a5eef7d3cca9c1ddb3247bf63f
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-11-18 10:18:44 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-11-18 10:18:44 +0000

    snd_maestro3: Do not hold sc_lock across the hwvol handlers
    
    mixer_hwvol_*() can end up taking sound(4)'s channel lock through
    mixer_set_softpcmvol() or mixer_set_eq(). m3_pchan_trigger() takes
    sc_lock with the channel lock already held, which can cause a LOR. Drop
    sc_lock for the duration of the hwvol handlers, as snd_uaudio(4) does
    for the same reason.
    
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D60464
---
 sys/dev/sound/pci/maestro3.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/dev/sound/pci/maestro3.c b/sys/dev/sound/pci/maestro3.c
index 6003dde5b41c..aee95444f7ee 100644
--- a/sys/dev/sound/pci/maestro3.c
+++ b/sys/dev/sound/pci/maestro3.c
@@ -1122,6 +1122,7 @@ m3_intr(void *p)
 		uint8_t event;
 
 		event = m3_rd_1(sc, HW_VOL_COUNTER_MASTER);
+		M3_UNLOCK(sc);
 		switch (event) {
 		case 0x99:
 			mixer_hwvol_mute(sc->dev);
@@ -1137,6 +1138,7 @@ m3_intr(void *p)
 		default:
 			device_printf(sc->dev, "Unknown HWVOL event\n");
 		}
+		M3_LOCK(sc);
 		m3_wr_1(sc, HW_VOL_COUNTER_MASTER, 0x88);
 	}