diff options
author | Rajiv Andrade <srajiv@linux.vnet.ibm.com> | 2010-11-12 16:30:02 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-01-23 19:22:48 -0500 |
commit | c4ff4b829ef9e6353c0b133b7adb564a68054979 (patch) | |
tree | 0b32c7b91763144ea587e2965f5a401eea3d537c | |
parent | 5403110943a2dcf1f96416d7a412a8b46895facd (diff) |
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 <srajiv@linux.vnet.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
-rw-r--r-- | 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 1f46f1cd9225..36e0fa161c2b 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, | |||
364 | tpm_protected_ordinal_duration[ordinal & | 364 | tpm_protected_ordinal_duration[ordinal & |
365 | TPM_PROTECTED_ORDINAL_MASK]; | 365 | TPM_PROTECTED_ORDINAL_MASK]; |
366 | 366 | ||
367 | if (duration_idx != TPM_UNDEFINED) | 367 | if (duration_idx != TPM_UNDEFINED) { |
368 | duration = chip->vendor.duration[duration_idx]; | 368 | duration = chip->vendor.duration[duration_idx]; |
369 | if (duration <= 0) | 369 | /* if duration is 0, it's because chip->vendor.duration wasn't */ |
370 | /* filled yet, so we set the lowest timeout just to give enough */ | ||
371 | /* time for tpm_get_timeouts() to succeed */ | ||
372 | return (duration <= 0 ? HZ : duration); | ||
373 | } else | ||
370 | return 2 * 60 * HZ; | 374 | return 2 * 60 * HZ; |
371 | else | ||
372 | return duration; | ||
373 | } | 375 | } |
374 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); | 376 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); |
375 | 377 | ||