ASoC: soc-compress: Fix race condition in soc_compr_open_fe
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): CGME20250623070342epcas2p40b58c1bf858f69021e917deddc76015d@epcas2p4.samsung.com
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
Signed-off-by Seungbin Lee <[email protected]>
--- sound/soc/soc-compress.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/soc-compress.c +4 -0
@@ -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