]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ALSA: timer: Fix leftover link at closing
authorTakashi Iwai <tiwai@suse.de>
Thu, 4 Feb 2016 16:06:13 +0000 (17:06 +0100)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 26 May 2016 22:44:44 +0000 (15:44 -0700)
commitbddc0af20e3576807d97a91c3308216cc4fc27dd
tree460d89fb491a99c731e862dbd737c44823d9429a
parent1869c9329f2de2813d7c46c23db50e4b89f9e7e9
ALSA: timer: Fix leftover link at closing

Orabug: 23330813

[ Upstream commit 094fd3be87b0f102589e2d5c3fa5d06b7e20496d ]

In ALSA timer core, the active timer instance is managed in
active_list linked list.  Each element is added / removed dynamically
at timer start, stop and in timer interrupt.  The problem is that
snd_timer_interrupt() has a thinko and leaves the element in
active_list when it's the last opened element.  This eventually leads
to list corruption or use-after-free error.

This hasn't been revealed because we used to delete the list forcibly
in snd_timer_stop() in the past.  However, the recent fix avoids the
double-stop behavior (in commit [f784beb75ce8: ALSA: timer: Fix link
corruption due to double start or stop]), and this leak hits reality.

This patch fixes the link management in snd_timer_interrupt().  Now it
simply unlinks no matter which stream is.

BugLink: http://lkml.kernel.org/r/CACT4Y+Yy2aukHP-EDp8-ziNqNNmb-NTf=jDWXMP7jB8HDa2vng@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit 451e9d9111a2c83d46cdd48d5eea2fa8e8d72d9a)

Signed-off-by: Dan Duval <dan.duval@oracle.com>
sound/core/timer.c