[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4D90B222.1060302@linux.vnet.ibm.com>
Date: Mon, 28 Mar 2011 13:06:58 -0300
From: Rajiv Andrade <srajiv@...ux.vnet.ibm.com>
To: Peter Huewe <huewe.external.infineon@...glemail.com>
CC: James Morris <jmorris@...ei.org>,
Linux kernel mailing list <linux-kernel@...r.kernel.org>
Subject: Re: [GIT PULL] TPM driver robustness fixes
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@...ibm.com>
Security Development
IBM Linux Technology Center
+55 19 81095527
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists