ASoc: msm: Fix the kernel panic issue in dapm
- Widget list in dapm is getting corrupted during concurrent
use cases where dapm_power_widget is accessed from core,
machine driver, codec driver and soc-dsp. This corruption
is resulting in kernel crash in dapm.
- Fix the issue by adding protection in dapm_power_widgets
API.
CRs-fixed: 351250
Change-Id: Ia977770b2c4081353918a40919aafd468bf3c4ed
Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>
diff --git a/sound/soc/msm/msm8960.c b/sound/soc/msm/msm8960.c
index abfadb8..44fab3f 100644
--- a/sound/soc/msm/msm8960.c
+++ b/sound/soc/msm/msm8960.c
@@ -254,6 +254,8 @@
{
struct snd_soc_dapm_context *dapm = &codec->dapm;
+ mutex_lock(&dapm->codec->mutex);
+
pr_debug("%s: msm8960_spk_control = %d", __func__, msm8960_spk_control);
if (msm8960_spk_control == MSM8960_SPK_ON) {
snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Pos");
@@ -268,6 +270,7 @@
}
snd_soc_dapm_sync(dapm);
+ mutex_unlock(&dapm->codec->mutex);
}
static int msm8960_get_spk(struct snd_kcontrol *kcontrol,