]> git.ipfire.org Git - thirdparty/linux.git/commit - sound/pci/hda/patch_realtek.c
ALSA: hda/realtek: Fix deadlock by COEF mutex
authorTakashi Iwai <tiwai@suse.de>
Mon, 14 Feb 2022 13:04:10 +0000 (14:04 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 14 Feb 2022 13:04:48 +0000 (14:04 +0100)
commit2a845837e3d0ddaed493b4c5c4643d7f0542804d
tree223ca9fc213b8715868a1042ca6c752fd88bd0be
parent9a5adeb28b77416446658e75bdef3bbe5fb92a83
ALSA: hda/realtek: Fix deadlock by COEF mutex

The recently introduced coef_mutex for Realtek codec seems causing a
deadlock when the relevant code is invoked from the power-off state;
then the HD-audio core tries to power-up internally, and this kicks
off the codec runtime PM code that tries to take the same coef_mutex.

In order to avoid the deadlock, do the temporary power up/down around
the coef_mutex acquisition and release.  This assures that the
power-up sequence runs before the mutex, hence no re-entrance will
happen.

Fixes: b837a9f5ab3b ("ALSA: hda: realtek: Fix race at concurrent COEF updates")
Reported-and-tested-by: Julian Wollrath <jwollrath@web.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220214132838.4db10fca@schienar
Link: https://lore.kernel.org/r/20220214130410.21230-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_realtek.c