From: Takashi Iwai Date: Tue, 28 Oct 2014 11:42:19 +0000 (+0100) Subject: ALSA: pcm: Zero-clear reserved fields of PCM status ioctl in compat mode X-Git-Tag: firefly_0821_release~176^2~2610^2~63 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=317168d0c766defd14b3d0e9c2c4a9a258b803ee;p=firefly-linux-kernel-4.4.55.git ALSA: pcm: Zero-clear reserved fields of PCM status ioctl in compat mode In compat mode, we copy each field of snd_pcm_status struct but don't touch the reserved fields, and this leaves uninitialized values there. Meanwhile the native ioctl does zero-clear the whole structure, so we should follow the same rule in compat mode, too. Reported-by: Pierre-Louis Bossart Cc: Signed-off-by: Takashi Iwai --- diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index 102e8fd1d450..2d957ba63557 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c @@ -210,6 +210,8 @@ static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream, if (err < 0) return err; + if (clear_user(src, sizeof(*src))) + return -EFAULT; if (put_user(status.state, &src->state) || compat_put_timespec(&status.trigger_tstamp, &src->trigger_tstamp) || compat_put_timespec(&status.tstamp, &src->tstamp) ||