linux/sound/synth/emux
Takashi Iwai 3ffa52f34a ALSA: emux: Fix mutex deadlock in OSS emulation
commit 1c94e65c66 upstream.

The OSS emulation in synth-emux helper has a potential AB/BA deadlock
at the simultaneous closing and opening:

  close ->
    snd_seq_release() ->
      sne_seq_free_client() ->
        snd_seq_delete_all_ports(): takes client->ports_mutex ->
	  port_delete() ->
	    snd_emux_unuse(): takes emux->register_mutex

  open ->
    snd_seq_oss_open() ->
      snd_emux_open_seq_oss(): takes emux->register_mutex ->
        snd_seq_event_port_attach() ->
	  snd_seq_create_port(): takes client->ports_mutex

This patch addresses the deadlock by reducing the rance taking
emux->register_mutex in snd_emux_open_seq_oss().  The lock is needed
for the refcount handling, so move it locally.  The calls in
emux_seq.c are already with the mutex, thus they are replaced with the
version without mutex lock/unlock.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
History 2015-05-12 09:36:38 +01:00
..
emux.c sound: Add module.h to the previously silent sound users 2011-10-31 19:31:21 -04:00
emux_effect.c [ALSA] Remove xxx_t typedefs: Emu-X synth 2006-01-03 12:18:14 +01:00
emux_hwdep.c ALSA: emux: Add trivial compat ioctl handler 2010-09-14 16:18:11 +02:00
emux_nrpn.c ALSA: Kill snd_assert() in other places 2008-08-13 11:46:40 +02:00
emux_oss.c ALSA: emux: Fix mutex deadlock in OSS emulation 2015-05-12 09:36:38 +01:00
emux_proc.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
emux_seq.c ALSA: emux: Fix mutex deadlock in OSS emulation 2015-05-12 09:36:38 +01:00
emux_synth.c sound: Add export.h for THIS_MODULE/EXPORT_SYMBOL where needed 2011-10-31 19:31:22 -04:00
emux_voice.h [ALSA] Remove sound/driver.h 2008-01-31 17:29:48 +01:00
Makefile ALSA: clean up the logic for building sequencer modules 2009-05-29 11:49:42 +02:00
soundfont.c ALSA: synth: emux: soundfont.c: Cleaning up memory leak 2014-06-01 14:33:09 +02:00