mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
To: Peter Huewe <huewe.external.infineon@googlemail.com>
Cc: James Morris <jmorris@namei.org>,
	Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [GIT PULL] TPM driver robustness fixes
Date: Mon, 28 Mar 2011 13:06:58 -0300	[thread overview]
Message-ID: <4D90B222.1060302@linux.vnet.ibm.com> (raw)
In-Reply-To: <AANLkTi=+QFL5aMym68Dx=Vgomy9MQRV1AB1AreTua_mW@mail.gmail.com>

On 03/22/2011 01:08 PM, Peter Huewe wrote:
> Or rather:
> diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
> index d184d75..2f2f65e 100644
> --- a/drivers/char/tpm/tpm.c
> +++ b/drivers/char/tpm/tpm.c
> @@ -1052,6 +1052,7 @@ ssize_t tpm_read(struct file *file, char __user *buf,
>  {
>         struct tpm_chip *chip = file->private_data;
>         ssize_t ret_size;
> +       int rc;
> 
>         del_singleshot_timer_sync(&chip->user_read_timer);
>         flush_work_sync(&chip->work);
> @@ -1062,8 +1063,11 @@ ssize_t tpm_read(struct file *file, char __user *buf,
>                         ret_size = size;
> 
>                 mutex_lock(&chip->buffer_mutex);
> -               if (copy_to_user(buf, chip->data_buffer, ret_size))
> +               rc = copy_to_user(buf, chip->data_buffer, ret_size);
> +               memset(chip->data_buffer, 0, ret_size);
> +               if (rc)
>                         ret_size = -EFAULT;
> +
>                 mutex_unlock(&chip->buffer_mutex);
>         }
> 
> 
> 
> Thanks,
> Peter

This approach is definitely the best.

Thanks,
Rajiv


-- 
Thanks,
Rajiv Andrade <srajiv@br.ibm.com>
Security Development
IBM Linux Technology Center
+55 19 81095527


  reply	other threads:[~2011-03-28 16:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-17  2:23 Rajiv Andrade
2011-03-17  2:26 ` Rajiv Andrade
2011-03-21 23:01 ` James Morris
     [not found]   ` <AANLkTimS1ss=977x3d-7Wcpj0wGthzW3_G+wqF1wQMc3@mail.gmail.com>
2011-03-22 12:58     ` Peter Huewe
2011-03-22 13:16       ` Rajiv Andrade
2011-03-22 16:08         ` Peter Huewe
2011-03-28 16:06           ` Rajiv Andrade [this message]
2011-04-14 21:35 ` Jeff Mahoney
2011-07-19  6:01 ` Eugene Teo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D90B222.1060302@linux.vnet.ibm.com \
    --to=srajiv@linux.vnet.ibm.com \
    --cc=huewe.external.infineon@googlemail.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome