• Takashi Iwai's avatar
    ALSA: seq: Fix link corruption by event error handling · 80ed6047
    Takashi Iwai authored
    commit f3ac9f73 upstream.
    
    The sequencer FIFO management has a bug that may lead to a corruption
    (shortage) of the cell linked list.  When a sequencer client faces an
    error at the event delivery, it tries to put back the dequeued cell.
    When the first queue was put back, this forgot the tail pointer
    tracking, and the link will be screwed up.
    
    Although there is no memory corruption, the sequencer client may stall
    forever at exit while flushing the pending FIFO cells in
    snd_seq_pool_done(), as spotted by syzkaller.
    
    This patch addresses the missing tail pointer tracking at
    snd_seq_fifo_cell_putback().  Also the patch makes sure to clear the
    cell->enxt pointer at snd_seq_fifo_event_in() for avoiding a similar
    mess-up of the FIFO linked list.
    Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    80ed6047
seq_fifo.c 5.9 KB