ALSA: seq: Fix link corruption by event error handling
[pandora-kernel.git] / sound / core / seq / seq_fifo.c
index 0d75afa..1184818 100644 (file)
@@ -137,6 +137,7 @@ int snd_seq_fifo_event_in(struct snd_seq_fifo *f,
        f->tail = cell;
        if (f->head == NULL)
                f->head = cell;
+       cell->next = NULL;
        f->cells++;
        spin_unlock_irqrestore(&f->lock, flags);
 
@@ -216,6 +217,8 @@ void snd_seq_fifo_cell_putback(struct snd_seq_fifo *f,
                spin_lock_irqsave(&f->lock, flags);
                cell->next = f->head;
                f->head = cell;
+               if (!f->tail)
+                       f->tail = cell;
                f->cells++;
                spin_unlock_irqrestore(&f->lock, flags);
        }