commit 1c94e65c668f44d2c69ae7e7fc268ab3268fba3e upstream.
The OSS emulation in synth-emux helper has a potential AB/BA deadlock
at the simultaneous closing and opening:
snd_seq_delete_all_ports(): takes client->ports_mutex ->
snd_emux_unuse(): takes emux->register_mutex
snd_emux_open_seq_oss(): takes emux->register_mutex ->
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 <email@example.com>
Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>