summaryrefslogtreecommitdiffstats
path: root/tpm-fix-stall-on-boot.patch
blob: adba40a6e990c045bdec59561e4438c09f628477 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Fix TPM timeouts on boot (#530393)

--- a/drivers/char/tpm/tpm.c	
+++ a/drivers/char/tpm/tpm.c	
@@ -354,12 +354,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 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);