ALSA: hda - Fix mutex deadlock in HDMI codec driver
authorTakashi Iwai <tiwai@suse.de>
Tue, 29 Oct 2019 20:41:20 +0000 (21:41 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 30 Oct 2019 14:32:37 +0000 (15:32 +0100)
commit302d5a80d232134246032bc4263fd7facdddb8f1
treeb36a354c7572ab6773c0f19c968044af9955eed6
parent1a7f60b9df614bb36d14dc0c0bc898a31b2b506f
ALSA: hda - Fix mutex deadlock in HDMI codec driver

The commit ade49db337a9 ("ALSA: hda/hdmi - Allow audio component for
AMD/ATI and Nvidia HDMI") introduced the spec->pcm_lock mutex lock to
the whole generic_hdmi_init() function for avoiding the race with the
audio component registration.  However, this caused a dead lock when
the unsolicited event is handled without the audio component, as the
codec gets runtime-resumed in hdmi_present_sense() which is already
inside the spec->pcm_lock in its caller.

For avoiding this deadlock, add a new mutex only for the audio
component binding that is used in both generic_hdmi_init() and the
audio notifier registration where the jack callbacks are handled /
re-registered.

Fixes: ade49db337a9 ("ALSA: hda/hdmi - Allow audio component for AMD/ATI and Nvidia HDMI")
Reported-and-tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/s5himo7i89i.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_hdmi.c