All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
@ 2024-02-11  9:58 Alexey Khoroshilov
  2024-02-12  0:57 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2024-02-11  9:58 UTC (permalink / raw)
  To: Oder Chiou
  Cc: Alexey Khoroshilov, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Shuming Fan, linux-sound, linux-kernel,
	lvc-project

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(+)

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;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
  2024-02-11  9:58 [PATCH] ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work() Alexey Khoroshilov
@ 2024-02-12  0:57 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2024-02-12  0:57 UTC (permalink / raw)
  To: Oder Chiou, Alexey Khoroshilov
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Shuming Fan,
	linux-sound, linux-kernel, lvc-project

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-12  0:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-11  9:58 [PATCH] ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work() Alexey Khoroshilov
2024-02-12  0:57 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.