summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-24 19:56:47 +1000
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-24 19:56:47 +1000
commitd20761a7995773dfae4a54fdd26a7857b861adb5 (patch)
tree14deebe09cf5a89a7b7ea1cab0ed45dbe4e5a627 /drivers/char/tpm/tpm.c
parentff5fdb61493d95332945630fcae249f896098652 (diff)
parent3ac285ff23cd6e1bc402b6db836521bce006eb89 (diff)
downloadblackbird-obmc-linux-d20761a7995773dfae4a54fdd26a7857b861adb5.tar.gz
blackbird-obmc-linux-d20761a7995773dfae4a54fdd26a7857b861adb5.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: selinux: return -ENOMEM when memory allocation fails tpm: fix panic caused by "tpm: Autodetect itpm devices" TPM: Long default timeout fix trusted keys: Fix a memory leak in trusted_update(). keys: add trusted and encrypted maintainers encrypted-keys: rename encrypted_defined files to encrypted trusted-keys: rename trusted_defined files to trusted
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r--drivers/char/tpm/tpm.c10
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,
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);
OpenPOWER on IntegriCloud