Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: seq: correctly detect input buffer overflow

snd_seq_event_dup returns -ENOMEM in some buffer-full conditions,
but usually returns -EAGAIN. Make -EAGAIN trigger the overflow
condition in snd_seq_fifo_event_in so that the fifo is cleared
and -ENOSPC is returned to userspace as stated in the alsa-lib docs.

Signed-off-by: Adam Goode <agoode@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Adam Goode and committed by
Takashi Iwai
21fd3e95 16088cb6

+1 -1
+1 -1
sound/core/seq/seq_fifo.c
··· 124 124 snd_use_lock_use(&f->use_lock); 125 125 err = snd_seq_event_dup(f->pool, event, &cell, 1, NULL); /* always non-blocking */ 126 126 if (err < 0) { 127 - if (err == -ENOMEM) 127 + if ((err == -ENOMEM) || (err == -EAGAIN)) 128 128 atomic_inc(&f->overflow); 129 129 snd_use_lock_free(&f->use_lock); 130 130 return err;