summaryrefslogtreecommitdiffstats
path: root/sound/core/seq/seq_memory.h
diff options
context:
space:
mode:
authorTakashi Iwai2017-03-21 13:56:04 +0100
committerTakashi Iwai2017-03-21 14:01:10 +0100
commitc520ff3d03f0b5db7146d9beed6373ad5d2a5e0e (patch)
treeded14dbde99a6392416d92153ebfa248a2493616 /sound/core/seq/seq_memory.h
parentALSA: x86: Make CONFIG_SND_X86 bool (diff)
downloadkernel-qcow2-linux-c520ff3d03f0b5db7146d9beed6373ad5d2a5e0e.tar.gz
kernel-qcow2-linux-c520ff3d03f0b5db7146d9beed6373ad5d2a5e0e.tar.xz
kernel-qcow2-linux-c520ff3d03f0b5db7146d9beed6373ad5d2a5e0e.zip
ALSA: seq: Fix racy cell insertions during snd_seq_pool_done()
When snd_seq_pool_done() is called, it marks the closing flag to refuse the further cell insertions. But snd_seq_pool_done() itself doesn't clear the cells but just waits until all cells are cleared by the caller side. That is, it's racy, and this leads to the endless stall as syzkaller spotted. This patch addresses the racy by splitting the setup of pool->closing flag out of snd_seq_pool_done(), and calling it properly before snd_seq_pool_done(). BugLink: http://lkml.kernel.org/r/CACT4Y+aqqy8bZA1fFieifNxR2fAfFQQABcBHj801+u5ePV0URw@mail.gmail.com Reported-and-tested-by: Dmitry Vyukov <dvyukov@google.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/seq/seq_memory.h')
-rw-r--r--sound/core/seq/seq_memory.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sound/core/seq/seq_memory.h b/sound/core/seq/seq_memory.h
index 4a2ec779b8a7..32f959c17786 100644
--- a/sound/core/seq/seq_memory.h
+++ b/sound/core/seq/seq_memory.h
@@ -84,6 +84,7 @@ static inline int snd_seq_total_cells(struct snd_seq_pool *pool)
int snd_seq_pool_init(struct snd_seq_pool *pool);
/* done pool - free events */
+void snd_seq_pool_mark_closing(struct snd_seq_pool *pool);
int snd_seq_pool_done(struct snd_seq_pool *pool);
/* create pool */