Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Artemii Karasev and committed by
Takashi Iwai
6a32425f 6c4715aa

+3
+3
sound/synth/emux/emux_nrpn.c
··· 349 349 snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan, 350 350 int param) 351 351 { 352 + if (param >= ARRAY_SIZE(chan->control)) 353 + return -EINVAL; 354 + 352 355 return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects), 353 356 port, chan, param, 354 357 chan->control[param],