From: Adam Goode Date: Wed, 4 Jun 2014 05:02:51 +0000 (-0400) Subject: ALSA: seq: correctly detect input buffer overflow X-Git-Tag: v3.2.102~139 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d89ffc7140e70fd8429f7147c552bdf22750a717;p=thirdparty%2Fkernel%2Fstable.git ALSA: seq: correctly detect input buffer overflow commit 21fd3e956ee8a307a06bc6e095f5767a00eb2a7e upstream. 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 Signed-off-by: Takashi Iwai Signed-off-by: Ben Hutchings --- diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c index 490b697e83ff5..e4389f1144156 100644 --- a/sound/core/seq/seq_fifo.c +++ b/sound/core/seq/seq_fifo.c @@ -127,7 +127,7 @@ int snd_seq_fifo_event_in(struct snd_seq_fifo *f, snd_use_lock_use(&f->use_lock); err = snd_seq_event_dup(f->pool, event, &cell, 1, NULL); /* always non-blocking */ if (err < 0) { - if (err == -ENOMEM) + if ((err == -ENOMEM) || (err == -EAGAIN)) atomic_inc(&f->overflow); snd_use_lock_free(&f->use_lock); return err;