tpm_crb: check for bad response size
authorJerry Snitselaar <jsnitsel@redhat.com>
Sat, 11 Mar 2017 00:46:04 +0000 (17:46 -0700)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Mon, 3 Apr 2017 19:46:02 +0000 (22:46 +0300)
commit8569defde8057258835c51ce01a33de82e14b148
tree6002ee224bde87f3a163f5e2656847d3731eb0c8
parent4d57856a21ed2abe33412e0526cc84bdcf67ea08
tpm_crb: check for bad response size

Make sure size of response buffer is at least 6 bytes, or
we will underflow and pass large size_t to memcpy_fromio().
This was encountered while testing earlier version of
locality patchset.

Cc: stable@vger.kernel.org
Fixes: 30fc8d138e912 ("tpm: TPM 2.0 CRB Interface")
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
drivers/char/tpm/tpm_crb.c