• Takashi Iwai's avatar
    ALSA: hda - Fix mutex deadlock in HDMI codec driver · 302d5a80
    Takashi Iwai authored
    The commit ade49db3 ("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: ade49db3 ("ALSA: hda/hdmi - Allow audio component for AMD/ATI and Nvidia HDMI")
    Reported-and-tested-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://lore.kernel.org/r/s5himo7i89i.wl-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    302d5a80
patch_hdmi.c 113 KB