]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - pending-4.9/alsa-seq-cover-unsubscribe_port-in-list_mutex.patch
move existing queues out of the way for the moment...
[thirdparty/kernel/stable-queue.git] / pending-4.9 / alsa-seq-cover-unsubscribe_port-in-list_mutex.patch
CommitLineData
64e30f16
GKH
1From 7c32ae35fbf9cffb7aa3736f44dec10c944ca18e Mon Sep 17 00:00:00 2001
2From: Takashi Iwai <tiwai@suse.de>
3Date: Fri, 12 Apr 2019 11:37:19 +0200
4Subject: ALSA: seq: Cover unsubscribe_port() in list_mutex
5
6From: Takashi Iwai <tiwai@suse.de>
7
8commit 7c32ae35fbf9cffb7aa3736f44dec10c944ca18e upstream.
9
10The call of unsubscribe_port() which manages the group count and
11module refcount from delete_and_unsubscribe_port() looks racy; it's
12not covered by the group list lock, and it's likely a cause of the
13reported unbalance at port deletion. Let's move the call inside the
14group list_mutex to plug the hole.
15
16Reported-by: syzbot+e4c8abb920efa77bace9@syzkaller.appspotmail.com
17Signed-off-by: Takashi Iwai <tiwai@suse.de>
18Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20---
21 sound/core/seq/seq_ports.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24--- a/sound/core/seq/seq_ports.c
25+++ b/sound/core/seq/seq_ports.c
26@@ -550,10 +550,10 @@ static void delete_and_unsubscribe_port(
27 list_del_init(list);
28 grp->exclusive = 0;
29 write_unlock_irq(&grp->list_lock);
30- up_write(&grp->list_mutex);
31
32 if (!empty)
33 unsubscribe_port(client, port, grp, &subs->info, ack);
34+ up_write(&grp->list_mutex);
35 }
36
37 /* connect two ports */