Commit f80e6d60 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: seq: Clear padded bytes at expanding events

There can be a small memory hole that may not be cleared at expanding
an event with the variable length type.  Make sure to clear it.
Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230523075358.9672-18-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent f4487c42
...@@ -152,12 +152,16 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char ...@@ -152,12 +152,16 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char
return -EINVAL; return -EINVAL;
if (copy_from_user(buf, (void __force __user *)event->data.ext.ptr, len)) if (copy_from_user(buf, (void __force __user *)event->data.ext.ptr, len))
return -EFAULT; return -EFAULT;
return newlen; } else {
err = snd_seq_dump_var_event(event,
in_kernel ? seq_copy_in_kernel : seq_copy_in_user,
&buf);
if (err < 0)
return err;
} }
err = snd_seq_dump_var_event(event, if (len != newlen)
in_kernel ? seq_copy_in_kernel : seq_copy_in_user, memset(buf + len, 0, newlen - len);
&buf); return newlen;
return err < 0 ? err : newlen;
} }
EXPORT_SYMBOL(snd_seq_expand_var_event); EXPORT_SYMBOL(snd_seq_expand_var_event);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment