summaryrefslogtreecommitdiff
path: root/tools/usb
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-03-22 16:00:54 +0100
committerTakashi Iwai <tiwai@suse.de>2019-03-22 16:27:03 +0100
commitca0214ee2802dd47239a4e39fb21c5b00ef61b22 (patch)
tree8fa36cfafe7dbd31bad5c36eb23e019b6e453725 /tools/usb
parent6ac371aa1a74240fb910c98aa3484d5ece8473d3 (diff)
ALSA: pcm: Fix possible OOB access in PCM oss plugins
The PCM OSS emulation converts and transfers the data on the fly via "plugins". The data is converted over the dynamically allocated buffer for each plugin, and recently syzkaller caught OOB in this flow. Although the bisection by syzbot pointed out to the commit 65766ee0bf7f ("ALSA: oss: Use kvzalloc() for local buffer allocations"), this is merely a commit to replace vmalloc() with kvmalloc(), hence it can't be the cause. The further debug action revealed that this happens in the case where a slave PCM doesn't support only the stereo channels while the OSS stream is set up for a mono channel. Below is a brief explanation: At each OSS parameter change, the driver sets up the PCM hw_params again in snd_pcm_oss_change_params_lock(). This is also the place where plugins are created and local buffers are allocated. The problem is that the plugins are created before the final hw_params is determined. Namely, two snd_pcm_hw_param_near() calls for setting the period size and periods may influence on the final result of channels, rates, etc, too, while the current code has already created plugins beforehand with the premature values. So, the plugin believes that channels=1, while the actual I/O is with channels=2, which makes the driver reading/writing over the allocated buffer size. The fix is simply to move the plugin allocation code after the final hw_params call. Reported-by: syzbot+d4503ae45b65c5bc1194@syzkaller.appspotmail.com Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'tools/usb')
0 files changed, 0 insertions, 0 deletions