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>
Wed, 6 May 2020 06:15:08 +0000 (08:15 +0200)
commitea63e38b29e7417ce5e20914fd617e5e19e03680
tree5fd31bd0ff425eab3cdbd2d0c9b30611b0801cab
parentc867614f196ae8acf5e644e1e1f1e18e280cb33b
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