diff mbox series

ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()

Message ID 1707645514-21196-1-git-send-email-khoroshilov@ispras.ru (mailing list archive)
State Accepted
Commit 6ef5d5b92f7117b324efaac72b3db27ae8bb3082
Headers show
Series ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work() | expand

Commit Message

Alexey Khoroshilov Feb. 11, 2024, 9:58 a.m. UTC
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>
---
 sound/soc/codecs/rt5645.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mark Brown Feb. 12, 2024, 12:57 a.m. UTC | #1
On Sun, 11 Feb 2024 12:58:34 +0300, Alexey Khoroshilov wrote:
> 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.
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
      commit: 6ef5d5b92f7117b324efaac72b3db27ae8bb3082

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 5150d6ee3748..0cc2fa131d48 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3317,6 +3317,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;