---------- Forwarded message ----------
Date: Mon, 24 Jan 2011 10:59:05 GMT
From: Linux Kernel Mailing List <[email protected]>
To: [email protected]
Subject: TPM: Long default timeout fix

Gitweb:     http://git.kernel.org/linus/c4ff4b829ef9e6353c0b133b7adb564a68054979
Commit:     c4ff4b829ef9e6353c0b133b7adb564a68054979
Parent:     5403110943a2dcf1f96416d7a412a8b46895facd
Author:     Rajiv Andrade <[email protected]>
AuthorDate: Fri Nov 12 22:30:02 2010 +0100
Committer:  James Morris <[email protected]>
CommitDate: Mon Jan 24 11:22:48 2011 +1100

    TPM: Long default timeout fix
    
    If duration variable value is 0 at this point, it's because
    chip->vendor.duration wasn't filled by tpm_get_timeouts() yet.
    This patch sets then the lowest timeout just to give enough
    time for tpm_get_timeouts() to further succeed.
    
    This fix avoids long boot times in case another entity attempts
    to send commands to the TPM when the TPM isn't accessible.
    
    Signed-off-by: Rajiv Andrade <[email protected]>
    Signed-off-by: James Morris <[email protected]>
---
 drivers/char/tpm/tpm.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 1f46f1c..36e0fa1 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -364,12 +364,14 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip 
*chip,
                    tpm_protected_ordinal_duration[ordinal &
                                                   TPM_PROTECTED_ORDINAL_MASK];
 
-       if (duration_idx != TPM_UNDEFINED)
+       if (duration_idx != TPM_UNDEFINED) {
                duration = chip->vendor.duration[duration_idx];
-       if (duration <= 0)
+               /* if duration is 0, it's because chip->vendor.duration wasn't 
*/
+               /* filled yet, so we set the lowest timeout just to give enough 
*/
+               /* time for tpm_get_timeouts() to succeed */
+               return (duration <= 0 ? HZ : duration);
+       } else
                return 2 * 60 * HZ;
-       else
-               return duration;
 }
 EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration);
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to