Hello Maintainers, Takashi and Jaroslav,
I am writing to respectfully follow up on a patch I submitted to the alsa-devel mailing list and Patchwork
I would like to bring up an important issue regarding the interaction between soc_compr_trigger_fe and snd_soc_dpcm_runtime_update.
If the soc_compr_trigger_fe function is called during the execution of snd_soc_dpcm_runtime_update, it may lead to unintended modification of the FE's DPCM runtime update variable. As a result, the BE list associated with the FE could become detached, preventing proper closure of the BE.
Ex)When repeatedly switching between deep playback and offload playback during MP3 playback
To prevent this race condition, access to this critical section should be protected using snd_soc_dpcm_mutex_lock. Ensuring mutual exclusion during these operations will maintain the integrity of the BE list and avoid potential resource leaks.
I understand that you have a large backlog of patches to review. If you have had a chance to look at it and found any issues, or if there's anything I need to fix or clarify, please let me know. I would be happy to prepare a v2 version if necessary.
Thank you very much for your time and attention to this matter.
Best regards,
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; }