Skip to contentSkip to conversation

ASoC: soc-compress: Fix race condition in soc_compr_open_fe

PATCH New 이승빈 1 participant 1 message Jun 23, 2025 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20250623070342epcas2p40b58c1bf858f69021e917deddc76015d@epcas2p4.samsung.com

이승빈

author
#1 lore raw

PATCH 1/1 ASoC: soc-compress: Fix race condition in soc_compr_open_fe

From: Seungbin Lee <[email protected]>
Date: Wed, 18 Jun 2025 13:33:02 +0900
Subject: [PATCH] ASoC: soc-compress: Fix race condition in soc_compr_open_fe

If the soc_compr_trigger_fe function is called during snd_soc_dpcm_runtime_update execution, the FE's DPCM runtime update variable may be changed.
Then the BE list connected to the FE flies away, and the BE cannot be closed.

This needs to be protected by the snd_soc_dpcm_mutex_lock.

Change-Id Ibfd1712e6baf41a30afa357a91ada83d205f968b
---
 sound/soc/soc-compress.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/soc/soc-compress.c +4 -0
index fc8db54352541..1a2a3fe6a2340 100644
@@ -286,6 +286,8 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
 
 	snd_soc_card_mutex_lock(fe->card);
 
+	snd_soc_dpcm_mutex_lock(fe);
+
 	ret = snd_soc_dai_compr_trigger(cpu_dai, cstream, cmd);
 	if (ret < 0)
 		goto out;
@@ -315,6 +317,8 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
 
 out:
 	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
+	snd_soc_dpcm_mutex_unlock(fe);
+
 	snd_soc_card_mutex_unlock(fe->card);
 	return ret;
 }
Signature · 1 line
2.34.1