From nobody Fri May 2 10:38:53 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 4ZpnTT6gfYz5vW8P; Fri, 02 May 2025 10:38:53 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZpnTT3SFSz4GxS; Fri, 02 May 2025 10:38:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746182333; 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=o10e3p+ulDOWVP8ZgHeaYftqTKK/vpdtuCJlYr11p+w=; b=W3ZkGW+FbvwWP6F4zPc9jN+d75nav2DBaCVyawb4+H3u9/c7xk0Gbs3i1F/APsMUGZrUzZ Q9sm0O5RkRs7UbLLpPR8R1tYrQRfaN4aalK6Q4RoCry3om2I+7fO5Hw9bBkOnNKa5QcmZb VMwUbMqareuS6ZGxSVkcLh/yHH7TubxyFl2I7aTde6DPgUaKjw4wo1mMkoh5pJ4EsOWBBk vBjgEC0TnANY2Q3wPD+WfxO3o3OYJxym+XP/JQQVAvs6dbVEULChcfy0SBSy8qo9OcXT2J Fnagdrh8qLrrUWsgDlHWoQ1libVkKAOhT0ZJ3j6wOnjsZ6Dq8saBoJgGEBOyRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746182333; 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=o10e3p+ulDOWVP8ZgHeaYftqTKK/vpdtuCJlYr11p+w=; b=i4+73Coxv+wCu2mbt8XllkYbtERWSbwlCuX+CJ/ZsrbjceuoGGxaCezydo6E2HTFcndSQV 1igNTNG7Luiu/Y4HQusNvryKp+MykUyGZNznNDCrE16R098b0rQSxhSLsrF3IFvjkIiTBB 15xHes+yCmjqetcRhIVTUwjhjvos6wmdgSOg8NtRNn0+4QIiRps+4Y8uJETkesZpIspKcM DRZzLD3p0sfFoZai/J3/EQPKdrDv1QJiUoJSqKtqAHofzi9gQnKapkul5EqquTxcgSJccJ plMRX31XrX7lFEH6zK0dqZFVfpjX1xSfZIgxeaqGQ1dCwRnIu3pK3jpdlS3YKg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1746182333; a=rsa-sha256; cv=none; b=tYCYxERBFgrxMQdViVS5VCEW1WSAqqTE2jY0uG+fEWFXz072/BoIIO7UF8q8C6rQ9K7i39 /e2ViIeQtZ7IuP7rpGu3vf9xWTDzFALBQczziZ1VQB6X73HL22ZBCb6WfJO70oZzV7pKCu rBNUSo4VpgWYghZuMYqZ0pbkApZYM7AbLuce6iPs1yioJyf1wa/CWnlcYK1qicAYhlwoTF DT6aKXUXQ98tMDAcsOU+waoB8wJX2KHs+wFCDfr42CPlLxa/6HauTf+bodNHclPrU1l1YY PMudK62AgoM79YQylqmQHtkzmx8lB8jCtTuUKWjvzfj5+ypTzWG8iV0U4bs7EQ== 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 4ZpnTT33cNz18ZR; Fri, 02 May 2025 10:38:53 +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 542Acr6w018585; Fri, 2 May 2025 10:38:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 542AcrXs018582; Fri, 2 May 2025 10:38:53 GMT (envelope-from git) Date: Fri, 2 May 2025 10:38:53 GMT Message-Id: <202505021038.542AcrXs018582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: c50c5a47a9d5 - main - snd_hda: Drain callout in hdac_detach() 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c50c5a47a9d515a7dbf584c10c7f66e56b29b305 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=c50c5a47a9d515a7dbf584c10c7f66e56b29b305 commit c50c5a47a9d515a7dbf584c10c7f66e56b29b305 Author: Christos Margiolis AuthorDate: 2025-05-02 10:38:41 +0000 Commit: Christos Margiolis CommitDate: 2025-05-02 10:38:41 +0000 snd_hda: Drain callout in hdac_detach() Because we do not drain the hdac callout during detach, hot-unloading can result in a panic if the callback fires after we have freed the resources it uses. pcm0: detached pcm1: detached hdaa0: detached hdacc0: detached Kernel page fault with the following non-sleepable locks held: exclusive sleep mutex hdac0 (HDA driver mutex) r = 0 (0xfffffe000212c820) locked @ /mnt/src/sys/dev/sound/pci/hda/hdac.c:400 [...] db_trace_self_wrapper() at db_trace_self_wrapper+0xa5/frame 0xfffffe0046b04490 kdb_backtrace() at kdb_backtrace+0xc6/frame 0xfffffe0046b045f0 vpanic() at vpanic+0x226/frame 0xfffffe0046b04790 panic() at panic+0xb5/frame 0xfffffe0046b04850 trap_fatal() at trap_fatal+0x65b/frame 0xfffffe0046b04950 trap_pfault() at trap_pfault+0x12b/frame 0xfffffe0046b04a70 trap() at trap+0x54c/frame 0xfffffe0046b04c50 calltrap() at calltrap+0x8/frame 0xfffffe0046b04c50 --- trap 0xc, rip = 0xffffffff8412e7ec, rsp = 0xfffffe0046b04d20, rbp = 0xfffffe0046b04d40 --- hdacc_stream_intr() at hdacc_stream_intr+0x3c/frame 0xfffffe0046b04d40 hdac_intr_handler() at hdac_intr_handler+0x15c/frame 0xfffffe0046b04d90 ithread_loop() at ithread_loop+0x387/frame 0xfffffe0046b04ef0 fork_exit() at fork_exit+0xa3/frame 0xfffffe0046b04f30 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0046b04f30 --- trap 0xc, rip = 0x829cc531a, rsp = 0x82b8b7a88, rbp = 0x82b8b7aa0 --- KDB: enter: panic [ thread pid 12 tid 100211 ] Stopped at kdb_enter+0x34: movq $0,0x1f09af1(%rip) db> Sponsored by: The FreeBSD Foundation MFC after: 1 day Reviewed by: kib, adrian Differential Revision: https://reviews.freebsd.org/D50087 --- sys/dev/sound/pci/hda/hdac.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index a4242d2d1609..602f5df93648 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -1748,8 +1748,10 @@ hdac_detach(device_t dev) 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);