ALSA: seq: Fix race at timer setup and close
authorTakashi Iwai <tiwai@suse.de>
Tue, 12 Jan 2016 14:36:27 +0000 (15:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 Jan 2016 19:28:55 +0000 (11:28 -0800)
commit0058ede73e1f441c003666f61671dfddfcbd5811
tree51a32793026398e0630a9de2a5dff99ebaa06e38
parent4aa59e944fbed2078a0c48872d7977a938c4753d
ALSA: seq: Fix race at timer setup and close

commit 3567eb6af614dac436c4b16a8d426f9faed639b3 upstream.

ALSA sequencer code has an open race between the timer setup ioctl and
the close of the client.  This was triggered by syzkaller fuzzer, and
a use-after-free was caught there as a result.

This patch papers over it by adding a proper queue->timer_mutex lock
around the timer-related calls in the relevant code path.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/core/seq/seq_queue.c