ALSA: pcm: oss: Place the plugin buffer overflow checks correctly
authorTakashi Iwai <tiwai@suse.de>
Fri, 24 Apr 2020 19:33:50 +0000 (21:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 May 2020 17:14:35 +0000 (19:14 +0200)
commita448f0b3bd43393b181e3dfdd1ae6d2f6047f438
tree3cb9432d69909ffb10aacec79191fa9484d5d86b
parentcd8f76d113019824f67d59b215e1a47423058e11
ALSA: pcm: oss: Place the plugin buffer overflow checks correctly

commit 4285de0725b1bf73608abbcd35ad7fd3ddc0b61e upstream.

The checks of the plugin buffer overflow in the previous fix by commit
  f2ecf903ef06 ("ALSA: pcm: oss: Avoid plugin buffer overflow")
are put in the wrong places mistakenly, which leads to the expected
(repeated) sound when the rate plugin is involved.  Fix in the right
places.

Also, at those right places, the zero check is needed for the
termination node, so added there as well, and let's get it done,
finally.

Fixes: f2ecf903ef06 ("ALSA: pcm: oss: Avoid plugin buffer overflow")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200424193350.19678-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/core/oss/pcm_plugin.c