From: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
To: James Morris <jmorris@namei.org>
Cc: Linux kernel mailing list <linux-kernel@vger.kernel.org>,
Peter Huewe <huewe.external.infineon@googlemail.com>
Subject: [GIT PULL] TPM driver robustness fixes
Date: Wed, 16 Mar 2011 23:23:09 -0300 [thread overview]
Message-ID: <4D81708D.5090607@linux.vnet.ibm.com> (raw)
Hi James,
The following changes since commit 2e270d84223262a38d4755c61d55f5c73ea89e56:
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 (2011-03-16 13:26:17 -0700)
are available in the git repository at:
git://tpmdd.git.sourceforge.net/gitroot/tpmdd/tpmdd/ for-james
Peter Huewe (3):
This patch changes the call of tpm_transmit by supplying the size of the userspace buffer instead of TPM_BUFSIZE
This patch fixes information leakage to the userspace by initializing the data buffer to zero
Since the buffer might contain security related data it might be a good idea to zero the buffer after we have copied it to userspace.
drivers/char/tpm/tpm.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 1f46f1c..c6d2cde 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -427,7 +427,7 @@ static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
goto out;
out_recv:
- rc = chip->vendor.recv(chip, (u8 *) buf, bufsiz);
+ rc = chip->vendor.recv(chip, (u8 *) buf, TPM_BUFSIZE);
if (rc< 0)
dev_err(chip->dev,
"tpm_transmit: tpm_recv: error %zd\n", rc);
@@ -980,7 +980,7 @@ int tpm_open(struct inode *inode, struct file *file)
return -EBUSY;
}
- chip->data_buffer = kmalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL);
+ chip->data_buffer = kzalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL);
if (chip->data_buffer == NULL) {
clear_bit(0,&chip->is_open);
put_device(chip->dev);
@@ -1035,7 +1035,7 @@ ssize_t tpm_write(struct file *file, const char __user *buf,
}
/* atomic tpm command send and result receive */
- out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE);
+ out_size = tpm_transmit(chip, chip->data_buffer, in_size);
atomic_set(&chip->data_pending, out_size);
mutex_unlock(&chip->buffer_mutex);
@@ -1064,6 +1064,7 @@ ssize_t tpm_read(struct file *file, char __user *buf,
mutex_lock(&chip->buffer_mutex);
if (copy_to_user(buf, chip->data_buffer, ret_size))
ret_size = -EFAULT;
+ memset(chip->data_buffer, 0, ret_size);
mutex_unlock(&chip->buffer_mutex);
}
next reply other threads:[~2011-03-17 2:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-17 2:23 Rajiv Andrade [this message]
2011-03-17 2:26 ` [GIT PULL] TPM driver robustness fixes 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
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=4D81708D.5090607@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.