lkml.org 
[lkml]   [2015]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.4 108/177] ALSA: pcm: Zero-clear reserved fields of PCM status ioctl in compat mode
    Date
    From: Takashi Iwai <tiwai@suse.de>

    3.4.106-rc1 review patch. If anyone has any objections, please let me know.

    ------------------


    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: Zefan Li <lizefan@huawei.com>
    ---
    sound/core/pcm_compat.c | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
    index 91cdf94..4dbb66e 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) ||
    --
    1.9.1


    \
     
     \ /
      Last update: 2015-01-28 05:41    [W:4.249 / U:0.236 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site