From nobody Wed Nov 18 10:24:46 2026 X-Original-To: dev-commits-src-all@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 4jTyQQ69Lnz71JKf for ; Wed, 18 Nov 2026 10:24:46 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jTyQQ366zz4fbn for ; Wed, 18 Nov 2026 10:24:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794997486; 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=yLhyN7U3Gh7Q9BCumaZd1oJxC6X4JunhEsbevSWxECg=; b=kjNFx/fcgFwPiMP8xGz2mPl83ELWqxLEHdojHvlXnnwYs7PVjQXLvahjdP/4M1OhQvy+bZ LlxSf2HNq6pi98Wx28crvlGsx7rtQrFGECbE/8sNjUeshi10f/4biOqtig9HPKubsfVR/F 4iBErU/X35pFrARXED6xym7qwKwz+c8C+X6qS3ycvdI7r/0ECC2aeBnv5T0HsQbf+Bkc0n 23LbBmIe0XrA9Aq3gup7quagnJ/jTjupQdnlP2FUn+Qy64kKRYmGESzHF4jEog1W1+iRp4 ZHQoXCefNVfb2p3v9NZxqY7DcffuUoxGpDeBMnI3FZFgBH0fO43YgWz9xf8BKQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794997486; b=si7+Ptyh4mm8fiFtz3+Zv0IcdgytP35TgMwsbBBg0p47n/lshC/sq765qYvJ803Ypzg/ym OQxz0mwY+7dekM7LVIaklevsgOM9wA5ye4NEOCtO/g5zXmFt/34/D3IXoA8svTV0K7hI1d BT5zLj8gpfW2UPSR4b0Pk4XUhOd7mQpP7sny2ZDDOWMQA9fOolNADrL2f7bpheJ3jYlFle S130LYVSOhk0fff9Kmxfzm6BF9v2gBxR4X6Lel6gLJt4DkkfOXhtnUe68JKhVW2UrhZrlM 5XtlVrEsV+vVl6CtasG4lKzWTZnaosAgbpbN/lj7/ggJ5O9kqKg4Mt/dTOQaWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794997486; 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=yLhyN7U3Gh7Q9BCumaZd1oJxC6X4JunhEsbevSWxECg=; b=fEE5JDGJcdb8zNSqbp5P/mLXTGdIVTvnaFOn7ZZGXF15POnVrK/WFEgGkalFPZBAYxYJwX xFcjayXK3pMOMcjRmsx3dL4tp5sw4i9+TNzYeCON615N3XlEQPeKlZO6XYHm9aYMA5i6EE DEggdcfo0OussCtUolxd8n0POZOX18dZ5JmpBI1crn1FC7ovjXqBziVZRMFGg98bvoHwYB DcHuwMiILXpNGiyJCAExx3jXPnXxH2026PVelkhvQmulKAFuQCTAzvPhRnHwdS6hNvHyTA PPxrhjrzibEIZRMbzS8mkPPtb93REfBeKdcH4gcWMFK9fJVcKqsdX+6JdTvD+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jTyQQ2Vcjz1PDm for ; Wed, 18 Nov 2026 10:24:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ee4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 18 Nov 2026 10:24:46 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 820403687783 - main - sound: Hold the topology lock across the remaining registration checks List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: 820403687783a0abb2e88ca1862ad349057cd3ce Auto-Submitted: auto-generated Date: Wed, 18 Nov 2026 10:24:46 +0000 Message-Id: <6afd7cee.3ee4.6ae2592c@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=820403687783a0abb2e88ca1862ad349057cd3ce commit 820403687783a0abb2e88ca1862ad349057cd3ce Author: Christos Margiolis AuthorDate: 2026-11-18 10:23:34 +0000 Commit: Christos Margiolis CommitDate: 2026-11-18 10:23:34 +0000 sound: Hold the topology lock across the remaining registration checks sysctl_dev_pcm_bitperfect(), sysctl_dev_pcm_eq() and sysctl_dev_pcm_eq_preamp() check PCM_REGISTERED() and then busy the device with nothing held in between, so pcm_unregister() can run and destroy the sx before PCM_ACQUIRE() takes it. These sysctls are registered in the device's newbus context, so they outlive pcm_unregister(). Hold the topology lock across the check and the busy, as the other handlers do. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D61224 --- sys/dev/sound/pcm/feeder_eq.c | 24 ++++++++++++++++++++---- sys/dev/sound/pcm/sound.c | 12 ++++++++++-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/sys/dev/sound/pcm/feeder_eq.c b/sys/dev/sound/pcm/feeder_eq.c index f23758634f13..1731312c0a5d 100644 --- a/sys/dev/sound/pcm/feeder_eq.c +++ b/sys/dev/sound/pcm/feeder_eq.c @@ -442,10 +442,18 @@ sysctl_dev_pcm_eq(SYSCTL_HANDLER_ARGS) int err, val, oval; d = oidp->oid_arg1; - if (!PCM_REGISTERED(d)) + bus_topo_lock(); + if (!PCM_REGISTERED(d)) { + bus_topo_unlock(); return (ENODEV); - + } + /* + * Do not give up the topology lock until the device is busied, or it + * might detach between unlocking and busying. + */ PCM_ACQUIRE(d); + bus_topo_unlock(); + if (d->flags & SD_F_EQ) val = 1; else @@ -480,10 +488,18 @@ sysctl_dev_pcm_eq_preamp(SYSCTL_HANDLER_ARGS) char buf[32]; d = oidp->oid_arg1; - if (!PCM_REGISTERED(d)) + bus_topo_lock(); + if (!PCM_REGISTERED(d)) { + bus_topo_unlock(); return (ENODEV); - + } + /* + * Do not give up the topology lock until the device is busied, or it + * might detach between unlocking and busying. + */ PCM_ACQUIRE(d); + bus_topo_unlock(); + val = d->eqpreamp; bzero(buf, sizeof(buf)); (void)snprintf(buf, sizeof(buf), "%c%d.%ddB", diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 65b43a66d758..5f12d3a23795 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -234,10 +234,18 @@ sysctl_dev_pcm_bitperfect(SYSCTL_HANDLER_ARGS) int err, val; d = oidp->oid_arg1; - if (!PCM_REGISTERED(d)) + bus_topo_lock(); + if (!PCM_REGISTERED(d)) { + bus_topo_unlock(); return (ENODEV); - + } + /* + * Do not give up the topology lock until the device is busied, or it + * might detach between unlocking and busying. + */ PCM_ACQUIRE(d); + bus_topo_unlock(); + val = (d->flags & SD_F_BITPERFECT) ? 1 : 0; err = sysctl_handle_int(oidp, &val, 0, req);