Skip to content

Commit 6a32425

Browse files
Artemii Karasevtiwai
authored andcommitted
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>
1 parent 6c4715a commit 6a32425

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

sound/synth/emux/emux_nrpn.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ int
349349
snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan,
350350
int param)
351351
{
352+
if (param >= ARRAY_SIZE(chan->control))
353+
return -EINVAL;
354+
352355
return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects),
353356
port, chan, param,
354357
chan->control[param],

0 commit comments

Comments
 (0)