kernel/kernel-2.6.33-tpm_calc_ordinal_duration.patch

22 lines
806 B
Diff

--- kernel-2.6.33mamba/drivers/char/tpm/tpm.c.orig 2010-09-29 22:17:07.000000000 +0200
+++ kernel-2.6.33mamba/drivers/char/tpm/tpm.c 2010-09-29 22:22:55.000000000 +0200
@@ -353,12 +353,14 @@ unsigned long tpm_calc_ordinal_duration(
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 to tpm_get_timeouts() succeed */
+ return (duration <= 0 ? HZ : duration);
+ } else
return 2 * 60 * HZ;
- else
- return duration;
}
EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration);