ALSA: timer: Fix double unlink of active_list 94/154894/1
authorTakashi Iwai <tiwai@suse.de>
Wed, 13 Jan 2016 20:35:06 +0000 (21:35 +0100)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 11 Oct 2017 10:40:59 +0000 (19:40 +0900)
commit ee8413b01045c74340aa13ad5bdf905de32be736 upstream.

ALSA timer instance object has a couple of linked lists and they are
unlinked unconditionally at snd_timer_stop().  Meanwhile
snd_timer_interrupt() unlinks it, but it calls list_del() which leaves
the element list itself unchanged.  This ends up with unlinking twice,
and it was caught by syzkaller fuzzer.

The fix is to use list_del_init() variant properly there, too.

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>
[sw0312.kim: cherry-pick from linux-3.10.y to fix CVE-2016-2545]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I86385e433465c415f8a9d5a11ec59cc128a80a9d

sound/core/timer.c

index 6ddcf06..3bd05d9 100644 (file)
@@ -693,7 +693,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
                } else {
                        ti->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
                        if (--timer->running)
-                               list_del(&ti->active_list);
+                               list_del_init(&ti->active_list);
                }
                if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) ||
                    (ti->flags & SNDRV_TIMER_IFLG_FAST))