• Takashi Iwai's avatar
    ALSA: timer: Fix leftover link at closing · 094fd3be
    Takashi Iwai authored
    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 [f784beb7: 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.comReported-by: default avatarDmitry Vyukov <dvyukov@google.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    094fd3be
timer.c 53.2 KB