[ALSA] Fix possible deadlocks in sequencer at removal of ports
authorTakashi Iwai <tiwai@suse.de>
Wed, 7 Feb 2007 13:07:08 +0000 (14:07 +0100)
committerJaroslav Kysela <perex@suse.cz>
Fri, 9 Feb 2007 08:03:58 +0000 (09:03 +0100)
Fix possible rwsem deadlocks in sequencer code at removal of
sequencer ports.  The list_lock of port group can be double
locked.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/core/seq/seq_ports.c

index d88153438d698a48808aa61c4ea6a3f0ff67740c..eefd1cf872b49efac2f67d35831cc54b061d0163 100644 (file)
@@ -245,9 +245,9 @@ static void clear_subscriber_list(struct snd_seq_client *client,
                                list_del(&subs->dest_list);
                        else
                                list_del(&subs->src_list);
+                       up_write(&agrp->list_mutex);
                        unsubscribe_port(c, aport, agrp, &subs->info, 1);
                        kfree(subs);
-                       up_write(&agrp->list_mutex);
                        snd_seq_port_unlock(aport);
                        snd_seq_client_unlock(c);
                }