[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1549201508.278166051@decadent.org.uk>
Date: Sun, 03 Feb 2019 14:45:08 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, Denis Kirjanov <kda@...ux-powerpc.org>,
syzbot+1cb36954e127c98dd037@...kaller.appspotmail.com,
"Takashi Iwai" <tiwai@...e.de>
Subject: [PATCH 3.16 172/305] ALSA: oss: Use kvzalloc() for local buffer
allocations
3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@...e.de>
commit 65766ee0bf7fe8b3be80e2e1c3ef54ad59b29476 upstream.
PCM OSS layer may allocate a few temporary buffers, one for the core
read/write and another for the conversions via plugins. Currently
both are allocated via vmalloc(). But as the allocation size is
equivalent with the PCM period size, the required size might be quite
small, depending on the application.
This patch replaces these vmalloc() calls with kvzalloc() for covering
small period sizes better. Also, we use "z"-alloc variant here for
addressing the possible uninitialized access reported by syzkaller.
Reported-by: syzbot+1cb36954e127c98dd037@...kaller.appspotmail.com
Signed-off-by: Takashi Iwai <tiwai@...e.de>
[bwh: Backported to 3.16: kvzalloc() does not exist, so only change to
using vzalloc()]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1075,7 +1075,7 @@ static int snd_pcm_oss_change_params_loc
runtime->oss.rate = params_rate(params);
vfree(runtime->oss.buffer);
- runtime->oss.buffer = vmalloc(runtime->oss.period_bytes);
+ runtime->oss.buffer = vzalloc(runtime->oss.period_bytes);
if (!runtime->oss.buffer) {
err = -ENOMEM;
goto failure;
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -67,7 +67,7 @@ static int snd_pcm_plugin_alloc(struct s
size /= 8;
if (plugin->buf_frames < frames) {
vfree(plugin->buf);
- plugin->buf = vmalloc(size);
+ plugin->buf = vzalloc(size);
plugin->buf_frames = frames;
}
if (!plugin->buf) {
Powered by blists - more mailing lists