Skip to content

Commit bc9dcb2

Browse files
tiwaigregkh
authored andcommitted
ALSA: seq: Cover unsubscribe_port() in list_mutex
commit 7c32ae3 upstream. The call of unsubscribe_port() which manages the group count and module refcount from delete_and_unsubscribe_port() looks racy; it's not covered by the group list lock, and it's likely a cause of the reported unbalance at port deletion. Let's move the call inside the group list_mutex to plug the hole. Reported-by: syzbot+e4c8abb920efa77bace9@syzkaller.appspotmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f40c32f commit bc9dcb2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎sound/core/seq/seq_ports.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,10 +550,10 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client,
550550
list_del_init(list);
551551
grp->exclusive = 0;
552552
write_unlock_irq(&grp->list_lock);
553-
up_write(&grp->list_mutex);
554553

555554
if (!empty)
556555
unsubscribe_port(client, port, grp, &subs->info, ack);
556+
up_write(&grp->list_mutex);
557557
}
558558

559559
/* connect two ports */

0 commit comments

Comments
 (0)