From: 이승빈 <seungbin.lee@samsung.com>
To: <alsa-devel@alsa-project.org>, <linux-sound@vger.kernel.org>,
<gregkh@linuxfoundation.org>, <perex@perex.cz>, <tiwai@suse.de>
Cc: <pilsun.jang@samsung.com>, <s47.kang@samsung.com>,
<donghee.moon@samsung.com>
Subject: [PATCH] ASoC: soc-compress: Fix race condition in soc_compr_open_fe
Date: Mon, 23 Jun 2025 16:03:41 +0900 [thread overview]
Message-ID: <009401dbe40c$f3df4dc0$db9de940$@samsung.com> (raw)
In-Reply-To: CGME20250623070342epcas2p40b58c1bf858f69021e917deddc76015d@epcas2p4.samsung.com
From: Seungbin Lee <seungbin.lee@samsung.com>
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 <seungbin.lee@samsung.com>
---
sound/soc/soc-compress.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index fc8db54352541..1a2a3fe6a2340 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -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;
}
--
2.34.1
next parent reply other threads:[~2025-06-27 13:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250623070342epcas2p40b58c1bf858f69021e917deddc76015d@epcas2p4.samsung.com>
2025-06-23 7:03 ` 이승빈 [this message]
[not found] <CGME20251210072722epcas2p4b9b1502712f5808a7a86979f4e6c8a81@epcas2p4.samsung.com>
2025-12-10 7:27 ` [PATCH] ASoC: soc-compress: Fix race condition in soc_compr_open_fe 이승빈
[not found] <CGME20250623014339epcas2p2c081aaeabc556a45faac59d2ffbba46e@epcas2p2.samsung.com>
2025-06-23 1:43 ` 이승빈
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='009401dbe40c$f3df4dc0$db9de940$@samsung.com' \
--to=seungbin.lee@samsung.com \
--cc=alsa-devel@alsa-project.org \
--cc=donghee.moon@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=pilsun.jang@samsung.com \
--cc=s47.kang@samsung.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.