This is a note to let you know that I've just added the patch titled

    TPM: Zero buffer whole after copying to userspace

to the 3.3-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tpm-zero-buffer-whole-after-copying-to-userspace.patch
and it can be found in the queue-3.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 3ab1aff89477dafb1aaeafe8c8669114a02b7226 Mon Sep 17 00:00:00 2001
From: Tim Gardner <[email protected]>
Date: Tue, 6 Dec 2011 11:29:20 -0700
Subject: TPM: Zero buffer whole after copying to userspace

From: Tim Gardner <[email protected]>

commit 3ab1aff89477dafb1aaeafe8c8669114a02b7226 upstream.

Commit 3321c07ae5068568cd61ac9f4ba749006a7185c9 correctly clears the TPM
buffer if the user specified read length is >= the TPM buffer length. However,
if the user specified read length is < the TPM buffer length, then part of the
TPM buffer is left uncleared.

Reported-by: Seth Forshee <[email protected]>
Cc: Debora Velarde <[email protected]>
Cc: Rajiv Andrade <[email protected]>
Cc: Marcel Selhorst <[email protected]>
Cc: [email protected]
Signed-off-by: Tim Gardner <[email protected]>
Signed-off-by: Rajiv Andrade <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/char/tpm/tpm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1221,12 +1221,13 @@ ssize_t tpm_read(struct file *file, char
        ret_size = atomic_read(&chip->data_pending);
        atomic_set(&chip->data_pending, 0);
        if (ret_size > 0) {     /* relay data */
+               ssize_t orig_ret_size = ret_size;
                if (size < ret_size)
                        ret_size = size;
 
                mutex_lock(&chip->buffer_mutex);
                rc = copy_to_user(buf, chip->data_buffer, ret_size);
-               memset(chip->data_buffer, 0, ret_size);
+               memset(chip->data_buffer, 0, orig_ret_size);
                if (rc)
                        ret_size = -EFAULT;
 


Patches currently in stable-queue which might be from [email protected] 
are

queue-3.3/tpm-zero-buffer-whole-after-copying-to-userspace.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to