summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.h
diff options
context:
space:
mode:
authorStefan Berger2017-01-19 13:19:12 +0100
committerJarkko Sakkinen2017-01-23 17:28:18 +0100
commitc659af78eb7b7d7be40f23d9d97bde58eb1368ac (patch)
tree88dfa2afb97240abe521a65639795bd969eb749e /drivers/char/tpm/tpm.h
parenttpm_tis: use default timeout value if chip reports it as zero (diff)
downloadkernel-qcow2-linux-c659af78eb7b7d7be40f23d9d97bde58eb1368ac.tar.gz
kernel-qcow2-linux-c659af78eb7b7d7be40f23d9d97bde58eb1368ac.tar.xz
kernel-qcow2-linux-c659af78eb7b7d7be40f23d9d97bde58eb1368ac.zip
tpm: Check size of response before accessing data
Make sure that we have not received less bytes than what is indicated in the header of the TPM response. Also, check the number of bytes in the response before accessing its data. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkine@linux.intel.com> Tested-by: Jarkko Sakkinen <jarkko.sakkine@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkine@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm.h')
-rw-r--r--drivers/char/tpm/tpm.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 1ae976894257..7216bd78b643 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -493,10 +493,11 @@ enum tpm_transmit_flags {
ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz,
unsigned int flags);
-ssize_t tpm_transmit_cmd(struct tpm_chip *chip, const void *cmd, int len,
- unsigned int flags, const char *desc);
+ssize_t tpm_transmit_cmd(struct tpm_chip *chip, const void *buf, size_t bufsiz,
+ size_t min_rsp_body_len, unsigned int flags,
+ const char *desc);
ssize_t tpm_getcap(struct tpm_chip *chip, u32 subcap_id, cap_t *cap,
- const char *desc);
+ const char *desc, size_t min_cap_length);
int tpm_get_timeouts(struct tpm_chip *);
int tpm1_auto_startup(struct tpm_chip *chip);
int tpm_do_selftest(struct tpm_chip *chip);