]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Sun, 11 Feb 2024 09:58:34 +0000 (12:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 07:42:23 +0000 (08:42 +0100)
[ 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>
sound/soc/codecs/rt5645.c

index 7dc80183921ed148b8e2fb3287dc0b309f939977..04457cbed5b4ee33726a5c23ad9c3cacfa04e739 100644 (file)
@@ -3276,6 +3276,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_read(rt5645->component, RT5645_A_JD_CTRL1) & 0x0020;