diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-01-04 14:19:15 +0300 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2017-12-07 05:20:12 +0300 |
commit | 01e135f94414d4fc0abf6febc48108d989ad7c45 (patch) | |
tree | ce3802eac00a4f5ec9202a0d9deb220331d0433d /sound/drivers | |
parent | db2e059fb898dc8142796b3a7010a626c0c398f5 (diff) | |
download | linux-01e135f94414d4fc0abf6febc48108d989ad7c45.tar.xz |
ALSA: vx: Fix possible transfer overflow
[ Upstream commit 874e1f6fad9a5184b67f4cee37c1335cd2cc5677 ]
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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'sound/drivers')
-rw-r--r-- | sound/drivers/vx/vx_pcm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c index 69f252585780..ea7b377f0378 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) { |