The branch main has been updated by tijl:

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

commit d4bfebf917bcecf23892bb5069ee91bec75bef71
Author:     Tijl Coosemans <t...@freebsd.org>
AuthorDate: 2025-05-24 10:58:29 +0000
Commit:     Tijl Coosemans <t...@freebsd.org>
CommitDate: 2025-09-04 20:35:07 +0000

    snd_hda: Fix a sporadic panic during kldunload
    
    The interrupt handler releases the device lock in hdaa_stream_intr to
    avoid a lock order reversal.  This allows child devices to be detached
    and destroyed and then the interrupt handler panics.
    
    Let hdac_detach take down the interrupt handler before detaching child
    devices and order hdac_driver so hdac_detach is called first.
    
    Remove duplicate hdac_if.h from the module Makefile.
    
    PR:             286385
    Reviewed by:    christos
    Differential Revision:  https://reviews.freebsd.org/D50393
---
 sys/dev/sound/pci/hda/hdac.c          | 10 +++++-----
 sys/modules/sound/driver/hda/Makefile |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c
index 900578b73de4..90cd74d28b3d 100644
--- a/sys/dev/sound/pci/hda/hdac.c
+++ b/sys/dev/sound/pci/hda/hdac.c
@@ -1773,17 +1773,17 @@ hdac_detach(device_t dev)
        struct hdac_softc *sc = device_get_softc(dev);
        int i, error;
 
+       callout_drain(&sc->poll_callout);
+       hdac_irq_free(sc);
+       taskqueue_drain(taskqueue_thread, &sc->unsolq_task);
+
        error = bus_generic_detach(dev);
        if (error != 0)
                return (error);
 
        hdac_lock(sc);
-       callout_stop(&sc->poll_callout);
        hdac_reset(sc, false);
        hdac_unlock(sc);
-       callout_drain(&sc->poll_callout);
-       taskqueue_drain(taskqueue_thread, &sc->unsolq_task);
-       hdac_irq_free(sc);
 
        for (i = 0; i < sc->num_ss; i++)
                hdac_dma_free(sc, &sc->streams[i].bdl);
@@ -2206,4 +2206,4 @@ static driver_t hdac_driver = {
        sizeof(struct hdac_softc),
 };
 
-DRIVER_MODULE(snd_hda, pci, hdac_driver, NULL, NULL);
+DRIVER_MODULE_ORDERED(snd_hda, pci, hdac_driver, NULL, NULL, SI_ORDER_ANY);
diff --git a/sys/modules/sound/driver/hda/Makefile 
b/sys/modules/sound/driver/hda/Makefile
index 0eec98fc53e1..1e137dc5671c 100644
--- a/sys/modules/sound/driver/hda/Makefile
+++ b/sys/modules/sound/driver/hda/Makefile
@@ -2,7 +2,7 @@
 
 KMOD=  snd_hda
 SRCS=  device_if.h bus_if.h pci_if.h channel_if.h mixer_if.h hdac_if.h
-SRCS+= hdaa.c hdaa.h hdaa_patches.c hdac.c hdac_if.h hdac_if.c
-SRCS+= hdacc.c hdac_private.h hdac_reg.h hda_reg.h hdac.h
+SRCS+= hdaa.c hdaa.h hdaa_patches.c hdacc.c hdac.c hdac_if.c
+SRCS+= hdac_private.h hdac_reg.h hda_reg.h hdac.h
 
 .include <bsd.kmod.mk>

Reply via email to