ALSA: seq: Fix race during FIFO resize
authorTakashi Iwai <tiwai@suse.de>
Fri, 24 Mar 2017 16:07:57 +0000 (17:07 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 12:03:14 +0000 (14:03 +0200)
commit28e0ebdd57cd3287ac821068364b74c70af3861c
treea6cf138f1e3b1489c265413de335dbff0626b483
parent2dbb155d5902591f3c87196645b4fd722e540809
ALSA: seq: Fix race during FIFO resize

commit 2d7d54002e396c180db0c800c1046f0a3c471597 upstream.

When a new event is queued while processing to resize the FIFO in
snd_seq_fifo_clear(), it may lead to a use-after-free, as the old pool
that is being queued gets removed.  For avoiding this race, we need to
close the pool to be deleted and sync its usage before actually
deleting it.

The issue was spotted by syzkaller.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Willy Tarreau <w@1wt.eu>
sound/core/seq/seq_fifo.c