summaryrefslogtreecommitdiff
path: root/sound/synth
diff options
context:
space:
mode:
authorArtemii Karasev <karasev@ispras.ru>2023-02-07 18:20:26 +0500
committerTakashi Iwai <tiwai@suse.de>2023-02-07 14:32:33 +0100
commit6a32425f953b955b4ff82f339d01df0b713caa5d (patch)
treedd5196f922aa5441e0447d10dee6058ab1dedad8 /sound/synth
parent6c4715aa5b0ab1c0d35780b7c552e952dbb5515d (diff)
ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control()
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: Artemii Karasev <karasev@ispras.ru> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20230207132026.2870-1-karasev@ispras.ru Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/synth')
-rw-r--r--sound/synth/emux/emux_nrpn.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/synth/emux/emux_nrpn.c b/sound/synth/emux/emux_nrpn.c
index 8056422ed7c5..0d6b82ae2955 100644
--- a/sound/synth/emux/emux_nrpn.c
+++ b/sound/synth/emux/emux_nrpn.c
@@ -349,6 +349,9 @@ int
snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan,
int param)
{
+ if (param >= ARRAY_SIZE(chan->control))
+ return -EINVAL;
+
return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects),
port, chan, param,
chan->control[param],