ASoC: soc-compress: Reposition and add pcm_mutex
A message that is not in the archive (sent off-list or not yet received): CGME20221202080032epcms2p68f56a6b43d7d6a4f0d2de9295c0e4ab4@epcms2p6
PATCH 1/1 ASoC: soc-compress: Reposition and add pcm_mutex
commit a385cc2614c17ba3002b263c0ca47dfbf6395c78 (HEAD -> fix_compr, master)
Author: s47.kang <[1][email protected]>
Date: Fri Dec 2 15:45:16 2022 +0900
ASoC: soc-compress.c: Reposition and add pcm_mutex.
If panic_on_warn is set and compress stream(DPCM) is started, then kernel panic will occurs because card->pcm_mutex isn't held
appropriately in
soc_compr_set_params_fe, soc_compr_open_fe and soc_compr_free_fe. So, I reposition and add pcm_mutex to resolve lockdep error.
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 870f13e1d389..7bce5088b455 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -149,6 +149,8 @@ static int soc_compr_open_fe(struct
snd_compr_stream *cstream)
if (ret < 0)
goto be_err;
+ mutex_lock_nested(&fe->card->pcm_mutex,
fe->card->pcm_subclass);
+
/* calculate valid and active FE <-> BE dpcms */
dpcm_process_paths(fe, stream, &list, 1);
fe->dpcm[stream].runtime = fe_substream->runtime;
@@ -184,7 +186,6 @@ static int soc_compr_open_fe(struct
snd_compr_stream *cstream)
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;
fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
- mutex_lock_nested(&fe->card->pcm_mutex,
fe->card->pcm_subclass);
snd_soc_runtime_activate(fe, stream);
mutex_unlock(&fe->card->pcm_mutex); @@ -215,7 +216,6 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
mutex_lock_nested(&fe->card->pcm_mutex,
fe->card->pcm_subclass);
snd_soc_runtime_deactivate(fe, stream); - mutex_unlock(&fe->card->pcm_mutex);
fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
@@ -234,6 +234,8 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
dpcm_be_disconnect(fe, stream);
+ mutex_unlock(&fe->card->pcm_mutex);
+
fe->dpcm[stream].runtime = NULL;
snd_soc_link_compr_shutdown(cstream, 0);
@@ -409,8 +411,9 @@ static int soc_compr_set_params_fe(struct
snd_compr_stream *cstream,
ret = snd_soc_link_compr_set_params(cstream);
if (ret < 0)
goto out;
-
+ mutex_lock_nested(&fe->card->pcm_mutex,
fe->card->pcm_subclass);
dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START);
+ mutex_unlock(&fe->card->pcm_mutex);
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
out:[cid:[email protected]]
[update?userid=s47.kang&do=bWFpbElEPTIwMjIxMjAyMDgwMDMyZXBjbXMycDY4ZjU2 YTZiNDNkN2Q2YTRmMGQyZGU5Mjk1YzBlNGFiNCZyZWNpcGllbnRBZGRyZXNzPWFsc2EtZGV 2ZWxAYWxzYS1wcm9qZWN0Lm9yZw__]
References
1. mailto:[email protected]
2. mailto:[email protected]
Quoted 3 lines · 강신형
<p>commit
a385cc2614c17ba3002b263c0ca47dfbf6395c78(HEAD ->fix_compr, master)<br />
Author: s47.kang <<a href="mailto:[email protected]">[email protected]</a>><br /> Date: Fri Dec 2 15:45:16 2022 +0900</p>
Your mail is HTML only so unfortunately I can't really read it and none of the tooling will be able to handle it.