stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.4 01/10] ALSA: seq: Cover unsubscribe_port() in list_mutex
@ 2019-06-04 23:25 Sasha Levin
  2019-06-04 23:25 ` [PATCH AUTOSEL 4.4 02/10] driver core: platform: Fix the usage of platform device name(pdev->name) Sasha Levin
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Sasha Levin @ 2019-06-04 23:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Takashi Iwai, syzbot+e4c8abb920efa77bace9, Sasha Levin

From: Takashi Iwai <tiwai@suse.de>

[ Upstream commit 7c32ae35fbf9cffb7aa3736f44dec10c944ca18e ]

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: Sasha Levin <sashal@kernel.org>
---
 sound/core/seq/seq_ports.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
index f04714d70bf7..a42e2ce4a726 100644
--- a/sound/core/seq/seq_ports.c
+++ b/sound/core/seq/seq_ports.c
@@ -550,10 +550,10 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client,
 		list_del_init(list);
 	grp->exclusive = 0;
 	write_unlock_irq(&grp->list_lock);
-	up_write(&grp->list_mutex);
 
 	if (!empty)
 		unsubscribe_port(client, port, grp, &subs->info, ack);
+	up_write(&grp->list_mutex);
 }
 
 /* connect two ports */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-06-05 12:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-04 23:25 [PATCH AUTOSEL 4.4 01/10] ALSA: seq: Cover unsubscribe_port() in list_mutex Sasha Levin
2019-06-04 23:25 ` [PATCH AUTOSEL 4.4 02/10] driver core: platform: Fix the usage of platform device name(pdev->name) Sasha Levin
2019-06-04 23:25 ` [PATCH AUTOSEL 4.4 03/10] Drivers: misc: fix out-of-bounds access in function param_set_kgdbts_var Sasha Levin
2019-06-04 23:25 ` [PATCH AUTOSEL 4.4 04/10] ipc: prevent lockup on alloc_msg and free_msg Sasha Levin
2019-06-04 23:25 ` [PATCH AUTOSEL 4.4 05/10] scsi: lpfc: add check for loss of ndlp when sending RRQ Sasha Levin
2019-06-04 23:25 ` [PATCH AUTOSEL 4.4 06/10] scsi: bnx2fc: fix incorrect cast to u64 on shift operation Sasha Levin
2019-06-04 23:25 ` [PATCH AUTOSEL 4.4 07/10] usbnet: ipheth: fix racing condition Sasha Levin
2019-06-04 23:25 ` [PATCH AUTOSEL 4.4 08/10] usbnet: fix kernel crash after disconnect Sasha Levin
2019-06-04 23:25 ` [PATCH AUTOSEL 4.4 09/10] KVM: x86/pmu: do not mask the value that is written to fixed PMUs Sasha Levin
2019-06-04 23:25 ` [PATCH AUTOSEL 4.4 10/10] KVM: s390: fix memory slot handling for KVM_SET_USER_MEMORY_REGION Sasha Levin
2019-06-05 12:14   ` Christian Borntraeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).