summaryrefslogtreecommitdiffstats
path: root/sound/drivers/vx
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-01-04 12:19:15 +0100
committerTakashi Iwai <tiwai@suse.de>2017-01-04 18:01:35 +0100
commit874e1f6fad9a5184b67f4cee37c1335cd2cc5677 (patch)
tree352304fa4287e1d7d9b5522f46f26fc8c92dcf9d /sound/drivers/vx
parentab949d519601880fd46e8bc1445d6a453bf2dc09 (diff)
downloadlinux-874e1f6fad9a5184b67f4cee37c1335cd2cc5677.tar.gz
linux-874e1f6fad9a5184b67f4cee37c1335cd2cc5677.tar.bz2
linux-874e1f6fad9a5184b67f4cee37c1335cd2cc5677.zip
ALSA: vx: Fix possible transfer overflow
The pseudo DMA transfer codes in VX222 and VX-pocket driver have a slight bug where they check the buffer boundary wrongly, and may overflow. Also, the zero sample count might be handled badly for the playback (although it shouldn't happen in theory). This patch addresses these issues. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=141541 Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/drivers/vx')
-rw-r--r--sound/drivers/vx/vx_pcm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index 11467272089e..41a617886cc7 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1048,8 +1048,10 @@ static void vx_pcm_capture_update(struct vx_core *chip, struct snd_pcm_substream
/* ok, let's accelerate! */
int align = pipe->align * 3;
space = (count / align) * align;
- vx_pseudo_dma_read(chip, runtime, pipe, space);
- count -= space;
+ if (space > 0) {
+ vx_pseudo_dma_read(chip, runtime, pipe, space);
+ count -= space;
+ }
}
/* read the rest of bytes */
while (count > 0) {