diff options
author | Artemii Karasev <karasev@ispras.ru> | 2023-02-07 18:20:26 +0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-22 12:46:04 +0100 |
commit | 45e37dc68867cf66e749879668534e34446fec8f (patch) | |
tree | 814edd622a9308c768757ba357595c8e994b401d /sound | |
parent | fdbdbd22ae25c2b65354fba4bc8ca97603a19923 (diff) | |
download | linux-stable-45e37dc68867cf66e749879668534e34446fec8f.tar.gz linux-stable-45e37dc68867cf66e749879668534e34446fec8f.tar.bz2 linux-stable-45e37dc68867cf66e749879668534e34446fec8f.zip |
ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control()
commit 6a32425f953b955b4ff82f339d01df0b713caa5d 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: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/synth/emux/emux_nrpn.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/synth/emux/emux_nrpn.c b/sound/synth/emux/emux_nrpn.c index 9729a15b6ae6..f4aa2706aeb6 100644 --- a/sound/synth/emux/emux_nrpn.c +++ b/sound/synth/emux/emux_nrpn.c @@ -363,6 +363,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], |