aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2011-03-30 12:13:26 -0400
committerRajiv Andrade <srajiv@linux.vnet.ibm.com>2011-07-12 17:53:07 -0400
commit829bf0675272d24ba0056f5f79e09544464f0c8d (patch)
tree7829db8e0f7ebff6596c0e0f2dd99aa82fa3de33 /drivers/char
parent04ab2293bbd36fc04060da93058cef7789414585 (diff)
tpm: Use interface timeouts returned from the TPM
The TPM driver currently discards the interface timeout values returned from the TPM. The check of the response packet needs to consider that the return_code field is 0 on success and the size of the expected packet is equivalent to the header size + u32 length indicator for the TPM_GetCapability() result + 4 interface timeout indicators of type u32. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 27abfd93714d..0a475c7fe5ce 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -545,9 +545,10 @@ void tpm_get_timeouts(struct tpm_chip *chip)
545 if (rc) 545 if (rc)
546 goto duration; 546 goto duration;
547 547
548 if (be32_to_cpu(tpm_cmd.header.out.length) 548 if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 ||
549 != 4 * sizeof(u32)) 549 be32_to_cpu(tpm_cmd.header.out.length)
550 goto duration; 550 != sizeof(tpm_cmd.header.out) + sizeof(u32) + 4 * sizeof(u32))
551 return;
551 552
552 timeout_cap = &tpm_cmd.params.getcap_out.cap.timeout; 553 timeout_cap = &tpm_cmd.params.getcap_out.cap.timeout;
553 /* Don't overwrite default if value is 0 */ 554 /* Don't overwrite default if value is 0 */