ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control()
commit6a32425f95
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:1da177e4c3
("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>
This commit is contained in:
parent
ab9b01a7ac
commit
9d26f571df
|
@ -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],
|
||||||
|
|
Loading…
Reference in New Issue