• Takashi Iwai's avatar
    ALSA: emux: Fix mutex deadlock at unloading · c19e7790
    Takashi Iwai authored
    commit 07b0e5d4 upstream.
    
    The emux-synth driver has a possible AB/BA mutex deadlock at unloading
    the emu10k1 driver:
    
      snd_emux_free() ->
        snd_emux_detach_seq(): mutex_lock(&emu->register_mutex) ->
          snd_seq_delete_kernel_client() ->
            snd_seq_free_client(): mutex_lock(&register_mutex)
    
      snd_seq_release() ->
        snd_seq_free_client(): mutex_lock(&register_mutex) ->
          snd_seq_delete_all_ports() ->
            snd_emux_unuse(): mutex_lock(&emu->register_mutex)
    
    Basically snd_emux_detach_seq() doesn't need a protection of
    emu->register_mutex as it's already being unregistered.  So, we can
    get rid of this for avoiding the deadlock.
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    c19e7790
emux_seq.c 8.68 KB