diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-28 12:42:19 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2014-12-14 16:23:52 +0000 |
commit | 5955adc323822ffe85c2bfd7c7e1224c1bfaca66 (patch) | |
tree | 5aa2001476a4843c2f267618a83a0d3ce4c0cdde | |
parent | cdeecb8176e2c86270af8f1aadb70869ac67a745 (diff) |
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: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | sound/core/pcm_compat.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index 91cdf9435fec..4dbb66ef435d 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c @@ -204,6 +204,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) || put_user(status.trigger_tstamp.tv_sec, &src->trigger_tstamp.tv_sec) || put_user(status.trigger_tstamp.tv_nsec, &src->trigger_tstamp.tv_nsec) || |