tpm: Check size of response before accessing data
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Thu, 19 Jan 2017 12:19:12 +0000 (07:19 -0500)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Mon, 23 Jan 2017 16:28:18 +0000 (18:28 +0200)
commitc659af78eb7b7d7be40f23d9d97bde58eb1368ac
tree88dfa2afb97240abe521a65639795bd969eb749e
parent1d70fe9d9c3a4c627f9757cbba5d628687b121c1
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>
drivers/char/tpm/tpm-interface.c
drivers/char/tpm/tpm-sysfs.c
drivers/char/tpm/tpm.h
drivers/char/tpm/tpm2-cmd.c
drivers/char/tpm/tpm_tis_core.c