summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-10-28 12:42:19 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-14 08:47:54 -0800
commita58d9ee3e1b064e8b449177dedab4d2da162fdd0 (patch)
tree872aac88ecdb78e96c82d256430b91875e980892
parentbcaf8f4d1aa458626c5563e60b3005ceea2327e5 (diff)
downloadlinux-3.10-a58d9ee3e1b064e8b449177dedab4d2da162fdd0.tar.gz
linux-3.10-a58d9ee3e1b064e8b449177dedab4d2da162fdd0.tar.bz2
linux-3.10-a58d9ee3e1b064e8b449177dedab4d2da162fdd0.zip
ALSA: pcm: Zero-clear reserved fields of PCM status ioctl in compat mode
commit 317168d0c766defd14b3d0e9c2c4a9a258b803ee upstream. 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 <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--sound/core/pcm_compat.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index af49721ba0e..c4ac3c1e19a 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -206,6 +206,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) ||