summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2024-02-11 12:58:34 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-02-23 08:12:55 +0100
commit3dd2d99e2352903d0e0b8769e6c9b8293c7454b2 (patch)
tree0903f86672154d01e9915dd7ac4b157a1c8979bb
parent80a642c11a91fdff66406b52197097d97685e4e1 (diff)
downloadlinux-stable-3dd2d99e2352903d0e0b8769e6c9b8293c7454b2.tar.gz
linux-stable-3dd2d99e2352903d0e0b8769e6c9b8293c7454b2.tar.bz2
linux-stable-3dd2d99e2352903d0e0b8769e6c9b8293c7454b2.zip
ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
[ Upstream commit 6ef5d5b92f7117b324efaac72b3db27ae8bb3082 ] There is a path in rt5645_jack_detect_work(), where rt5645->jd_mutex is left locked forever. That may lead to deadlock when rt5645_jack_detect_work() is called for the second time. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: cdba4301adda ("ASoC: rt5650: add mutex to avoid the jack detection failure") Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Link: https://lore.kernel.org/r/1707645514-21196-1-git-send-email-khoroshilov@ispras.ru Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--sound/soc/codecs/rt5645.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 37ad3bee66a4..5ec6e9f251c5 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3313,6 +3313,7 @@ static void rt5645_jack_detect_work(struct work_struct *work)
report, SND_JACK_HEADPHONE);
snd_soc_jack_report(rt5645->mic_jack,
report, SND_JACK_MICROPHONE);
+ mutex_unlock(&rt5645->jd_mutex);
return;
case 4:
val = snd_soc_component_read32(rt5645->component, RT5645_A_JD_CTRL1) & 0x0020;