From nobody Wed Nov 18 10:24:45 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 4jTyQP5lJ2z71JS7 for ; Wed, 18 Nov 2026 10:24:45 +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 4jTyQP3Fj3z4fl7 for ; Wed, 18 Nov 2026 10:24:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794997485; 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=9DV9iaHL+qYA7Z4FpY+blEPcS1cSHC11BSx4vMvNiaU=; b=a9z0ZO0UaN3kL/K5dMR50yHAfGS9QRrgKc4lJj0V1pXsGFCHOL48BB7A38EBsce4dAl7v2 iwkseWcbrbs3KvwOtQqP0BsVnIWiJhXh07FQColY5kayOuR3o4sc370uB6F3zaCe4xcaDG Qs6Yd3DJKFZtHF2C5hfSwnxV6lro2olt+D/nTtTfd+98lYEoZkOwTzPRI1/7NsnCUU/CTC 5VD19wogD4crhZaYIppsayK2BzsH1eG3XldQnhij9HMNEFyVyCPun31jWEfJwgSaz/oKA1 6g1PCOc6bjP1g4Q+Owc6Ga5GuxL5dpL3VoEdv365eJl1KSeCs6qIvY7IfoOyIg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794997485; b=AmYqucJhfZ/1iwvirHKM8u4/nqAjG7Z7KPfOyclwTgWfLg81hZdXhsB7Roc/eKzhrPCITW iPL6++2VniV19wXpojxibCu0aHQ1a97ErDiqRreqLXmCWZonniaL5opkTAdT+4BQYmi1IX V9pJc7wvyG8JtDf28k8Ih0GjP9xS0gyL+HPs4CjzJlcI7I6ivV+JiMHgJCi59O1fXxRHop 6jM6tKdPYx3gejfHWkdYcpv+j8q9/GTk/m0kIC20JtLcIC0+Ia0bcoLm5TKHC9CvSdGtLx yXuyAIMLcSSA3oHaVnTvmDY3KqrdTCcCsQSEHAVihr8bv9v6QnmcNKeX7rywDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794997485; 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=9DV9iaHL+qYA7Z4FpY+blEPcS1cSHC11BSx4vMvNiaU=; b=IvMRiKTvCS9anguaxBYrJpwWvWqreSDZNomtqzsyXcPmfBVnDGi9zxRRDWgUaedNZ9EUL1 Ohk0gSxr40JjWI7g/8dunfeGMeJRwAC8SGqFxFwbV3tID8l8pml4X6XaNjmTlJKEf6An/L BTiy2/mCk+a5LuJNNSveCQv9PwQ0TAd1QMBszVRPWtf/IONpvrq53mjgPnWuf+EkGXyoQ0 V82kKOotYz/SgVE2MqNCVf0rEtIbKcBlU6k5r9TFSzMpjuKQ6a3aJMSEjeaMEB+5n15cvD dkjw+bdUfYIZzqevj8x7i67X8gD1uCGZZlGsg4IrVizdgoQ2oeAJIKsouSSTyQ== 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 4jTyQP26xNz1PGy for ; Wed, 18 Nov 2026 10:24:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ee0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 18 Nov 2026 10:24:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 406358d55795 - main - sound: Fix a LOR between AIOGCAP and SNDCTL_DSP_SYNCGROUP 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: 406358d55795a6f3ea302a5e4c0289a9a4ca8e7d Auto-Submitted: auto-generated Date: Wed, 18 Nov 2026 10:24:45 +0000 Message-Id: <6afd7ced.3ee0.56359e79@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=406358d55795a6f3ea302a5e4c0289a9a4ca8e7d commit 406358d55795a6f3ea302a5e4c0289a9a4ca8e7d Author: Christos Margiolis AuthorDate: 2026-11-18 10:23:14 +0000 Commit: Christos Margiolis CommitDate: 2026-11-18 10:23:14 +0000 sound: Fix a LOR between AIOGCAP and SNDCTL_DSP_SYNCGROUP AIOGCAP locks a dsp_cdevpriv's record channel and then its play channel, while dsp_oss_syncgroup() locked them the other way round. Verified the LOR and deadlock by exercising both paths using a duplex FD concurrently. Lock the record channel first in dsp_oss_syncgroup() too, and document the order in sound.h. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D60519 --- sys/dev/sound/pcm/dsp.c | 10 +++++----- sys/dev/sound/pcm/sound.h | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index d1e9c1f7bc89..77faac3b5589 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -2487,16 +2487,16 @@ dsp_oss_syncgroup(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_syncgr /* * If device's channels are already mapped to a group, unmap them. */ - if (wrch) { - CHN_LOCK(wrch); - sg_ids[0] = chn_syncdestroy(wrch); - } - if (rdch) { CHN_LOCK(rdch); sg_ids[1] = chn_syncdestroy(rdch); } + if (wrch) { + CHN_LOCK(wrch); + sg_ids[0] = chn_syncdestroy(wrch); + } + /* * Verify that mode matches character device properites. * - Bail if PCM_ENABLE_OUTPUT && wrch == NULL. diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index c09ea120bcf0..7e71d18f063f 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -181,6 +181,8 @@ int snd_setup_intr(device_t dev, struct resource *res, int flags, * Lock order: * * Giant -> PCM_ACQUIRE() -> PCM_LOCK() -> CHN_LOCK(parent) -> CHN_LOCK(child). + * + * A dsp_cdevpriv's record channel is locked before its play channel. */ struct snddev_info { struct {