提交 b675d5d9 编写于 作者: A Artemii Karasev 提交者: zhaoxiaoqiang11

ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control()

stable inclusion
from stable-v5.10.168
commit e1646e2be9561469ff26c11295ad14b6c32e670f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7URR4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e1646e2be9561469ff26c11295ad14b6c32e670f

----------------------------------------------------

commit 6a32425f upstream.

snd_emux_xg_control() can be called with an argument 'param' greater
than size of 'control' array. It may lead to accessing 'control'
array at a wrong index.

Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: NArtemii Karasev <karasev@ispras.ru>
Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230207132026.2870-1-karasev@ispras.ruSigned-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Nzhaoxiaoqiang11 <zhaoxiaoqiang11@jd.com>
上级 d681d344
...@@ -349,6 +349,9 @@ int ...@@ -349,6 +349,9 @@ int
snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan, snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan,
int param) int param)
{ {
if (param >= ARRAY_SIZE(chan->control))
return -EINVAL;
return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects), return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects),
port, chan, param, port, chan, param,
chan->control[param], chan->control[param],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册