From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795030239; b=aFFAmCEzHJiB9pVO7W4vhnctkaGtQxbiHnU0DDUb/ZkI+ss3hoXvv18QGBeXdJNYh7lX 7YOZM31QJqeR6C3epvFSjk4/TF/mdr4MsL0Tw5Z0MTuXALrrdm/cjzSr4/Un++rn3f/fP PhWKmD5uFNLtP1xaA2GoMkjnRtUnsvlnv/Ygm4+K9bZV/O28Si7WuFRdj+5VALEp7g4Uy Nqwjm/OLEKNL02pDMcno+JbZxT4JNH2D6V+6pRRIjvjyi11MzWK9nInnfh5QOSFQyJjny GFnKQp54YwhsPOxywEesMKvTBvPDgLH3osUHMpLdyYsABe2+AaEQ2eFiwZ4UR1vCJNQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795030239; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=o8HXSQhgGRPA+6Bnd4eDfpsbcmDir/zeCAJdvKv44b4=; b=Nr33hwGwmhDf3hX/5zqZ0WIwnnqUMs2xiBBLXv5Eb7JF0HJPOIxsihGPENJifjL2LTFI 66CjN5SnEAFCAf4xrwoD1QfkabrOh6UwxWp96qrNfKSVwDMQtE5iMmJXbM88YGqZ1FHTr 6rLrj0cW1vjlWCQVe+mCLH+Fj5W4M9gvOt5YbFtfY0LxOyyidUQqp/Tly5GlhFijCKEgb VVIYyjxS88LoOS/D5rds81TUtpk4qBKnFW0W31toT9PeUS6lMka0UOs2QSfK1qLSOYjn5 CsyINkPxhYJZsu/4vSAbD4VdWKw+PGwG4vzBjjVZqI9xZVO5vvevYtHZeoYt07ngwOQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=kphAqvrA; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D260606F610; Wed, 18 Nov 2026 19:30:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=kphAqvrA Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB9691F000CC; Wed, 18 Nov 2026 19:30:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795030239; bh=o8HXSQhgGRPA+6Bnd4eDfpsbcmDir/zeCAJdvKv44b4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kphAqvrAVtjsoAmalTkjbS0MZUElABhMw/0hNq9juhEx4HvJTAGEpAG4JQr+/r9CD Tzt8eWWM7yC0mDXZlJV1iTJmNdIz7CWstF20QOnqoDRigtBaAjwhS2lavBPDP1pgot Arp1mMp074Yu/po6cX4dKQt8mCM1bM2JZudnrmg8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Runyu Xiao , Takashi Iwai , Sasha Levin Subject: [PATCH 6.12 0633/1756] ALSA: oxygen: use helper to activate the SPDIF PCM control Date: Wed, 18 Nov 2026 15:46:00 +0100 Message-ID: <20261118150034.062616726@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150007.957976754@linuxfoundation.org> References: <20261118150007.957976754@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Runyu Xiao [ Upstream commit 5bdc232c3094304a7e17df5ddb66dcdacbead6bf ] oxygen_open() and oxygen_close() modify the SPDIF PCM control access flags while holding chip->mutex. Direct access changes bypass the control core locking and notification path. Move the access transition outside the driver mutex and use snd_ctl_activate_id(), which serializes the control update with the control core. Fixes: d0ce9946c52e ("[ALSA] add CMI8788 driver") Assisted-by: LLM Signed-off-by: Runyu Xiao Link: https://patch.msgid.link/20260927121709.742840-1-runyu.xiao@seu.edu.cn Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/oxygen/oxygen_pcm.c | 37 +++++++++++++++-------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index 8b4f7269753ad..dda8d9897b4ad 100644 --- a/sound/pci/oxygen/oxygen_pcm.c +++ b/sound/pci/oxygen/oxygen_pcm.c @@ -171,16 +171,14 @@ static int oxygen_open(struct snd_pcm_substream *substream, snd_pcm_set_sync(substream); chip->streams[channel] = substream; - guard(mutex)(&chip->mutex); - chip->pcm_active |= 1 << channel; - if (channel == PCM_SPDIF) { - chip->spdif_pcm_bits = chip->spdif_bits; - chip->controls[CONTROL_SPDIF_PCM]->vd[0].access &= - ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; - snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE | - SNDRV_CTL_EVENT_MASK_INFO, - &chip->controls[CONTROL_SPDIF_PCM]->id); + scoped_guard(mutex, &chip->mutex) { + chip->pcm_active |= 1 << channel; + if (channel == PCM_SPDIF) + chip->spdif_pcm_bits = chip->spdif_bits; } + if (channel == PCM_SPDIF) + snd_ctl_activate_id(chip->card, + &chip->controls[CONTROL_SPDIF_PCM]->id, 1); return 0; } @@ -220,19 +218,16 @@ static int oxygen_close(struct snd_pcm_substream *substream) struct oxygen *chip = snd_pcm_substream_chip(substream); unsigned int channel = oxygen_substream_channel(substream); - guard(mutex)(&chip->mutex); - chip->pcm_active &= ~(1 << channel); - if (channel == PCM_SPDIF) { - chip->controls[CONTROL_SPDIF_PCM]->vd[0].access |= - SNDRV_CTL_ELEM_ACCESS_INACTIVE; - snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE | - SNDRV_CTL_EVENT_MASK_INFO, - &chip->controls[CONTROL_SPDIF_PCM]->id); - } - if (channel == PCM_SPDIF || channel == PCM_MULTICH) - oxygen_update_spdif_source(chip); + scoped_guard(mutex, &chip->mutex) { + chip->pcm_active &= ~(1 << channel); + if (channel == PCM_SPDIF || channel == PCM_MULTICH) + oxygen_update_spdif_source(chip); - chip->streams[channel] = NULL; + chip->streams[channel] = NULL; + } + if (channel == PCM_SPDIF) + snd_ctl_activate_id(chip->card, + &chip->controls[CONTROL_SPDIF_PCM]->id, 0); return 0; } -- 2.53.0