From nobody Thu Sep 4 20:40:13 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cHrvd6Rv9z66THS; Thu, 04 Sep 2025 20:40:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cHrvd5mlLz3hmG; Thu, 04 Sep 2025 20:40:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757018413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PLZ3l9hgRKQumyd+K0CDlZPjaQVG552QNg86ihRG5C4=; b=dDdWiZfXP+g8FL6fBL20lGcuLQDz1qIW1yVTmQaczI+bQs8QSLl09uRuDoHlkbR8kZAl4l 52kOcnHzbB2oVYp2/+TceMFv0lIdhPrUxiiUnieaddswzkXDpheAQKwFDxZaekJHSdzA8b 1UY4r4ZedfYn4W2kFmVvWjCWSvuDIHGSdTIHk7Hw4QPVUMswuC78PAtQ3Eev9FfbjWPLWl nyWQ8cY0SOJyN/whrJ0LiQXZlLBhigqcZAwYYHOyuzGNEa/VDDHGIaDAJizfGVINfufluf WLBMASvhgQ0wy6YwGLjvPr+XAHHE1CrkmBh3hK48hieH8r42SiOAFW1dRQwjVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757018413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PLZ3l9hgRKQumyd+K0CDlZPjaQVG552QNg86ihRG5C4=; b=pfl9tIlgXv2kNZKVPXhS45uROjzgRu6Z+4rUidIKw8x6Ta74QDBwf7JSd/s93MB/wgi9v4 Gt7pOVIc3AaiOlV7Qri4HPBPT5mD+96TppxabkWDrqkqEkfgiTvknK7sa1p9DXVN82L1cH Q5irE+lHVVSgbqoYNGoei8cZAQHgYJgF6J4sUo5ttSAcanJE+Ryxl9nS5l9xVoWWeFT3cY 5iBEF6S9XOOpL1AfvEPBYgqa0H/mtqHqaeb5J9W+lgNlkoAdlg8wcxe0d9n0K/rI0YeBT9 SVeLAWt7GqWEEckGSDmivyOVN7k0iH5zwU2vOdT9JmIJIXrgZyXasHgyIwTWfA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757018413; a=rsa-sha256; cv=none; b=Gd8w2XbH8FL9HQ4mEjHNckqMDvEdF3M2FbJ+7BmTyRRhPLgGlDYqdWW2rO6eArMLkXHKZ3 ezcXVWuyOhLUQNmvxam1vsw6Uo9Gcgcin/0FetTh1TfpeSYRk8VK/GU4gpjOyu6jRC28Fc k35itTk3oIfOnWa4ktodvubfqcrDJrra21HCg0VAb3uqrMO2bb6qCJAo9COVFwCRV1wk6c +flq51HEEfXD/3L4Na0JeC5VtelSxQJy0SHmmqH87d7YRX0ICHpDjZ17+nGFuJQQPQZwpH sCv7fTAKidW4f+BbyFn4mh5Dr7eVAf4ubsdX811ikAKrohEQW1jwSzLvi0JvKA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cHrvd53skz3gZ; Thu, 04 Sep 2025 20:40:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 584KeDwC010454; Thu, 4 Sep 2025 20:40:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 584KeDbH010446; Thu, 4 Sep 2025 20:40:13 GMT (envelope-from git) Date: Thu, 4 Sep 2025 20:40:13 GMT Message-Id: <202509042040.584KeDbH010446@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Tijl Coosemans Subject: git: d4bfebf917bc - main - snd_hda: Fix a sporadic panic during kldunload List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tijl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4bfebf917bcecf23892bb5069ee91bec75bef71 Auto-Submitted: auto-generated The branch main has been updated by tijl: URL: https://cgit.FreeBSD.org/src/commit/?id=d4bfebf917bcecf23892bb5069ee91bec75bef71 commit d4bfebf917bcecf23892bb5069ee91bec75bef71 Author: Tijl Coosemans AuthorDate: 2025-05-24 10:58:29 +0000 Commit: Tijl Coosemans 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