]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: emux: Fix mutex deadlock at unloading
authorTakashi Iwai <tiwai@suse.de>
Mon, 27 Apr 2015 12:50:39 +0000 (14:50 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 27 Apr 2015 12:50:39 +0000 (14:50 +0200)
commit5416737e3116b18e240f1bd68f6b36b9255a53dc
tree6051c7e586368aa4bf6c740834e70864307f9bf3
parent4767e53a2ea8efc4c51c16007699e07b70516ba3
ALSA: emux: Fix mutex deadlock at unloading

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.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/synth/emux/emux_seq.c