tpm: Make sure the locality received from backend is valid

Make sure that the locality passed from the backend to
tpm_tis_request_completed() is valid.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
stable-4.0
Stefan Berger 2018-12-04 09:54:39 -05:00
parent e92b63ea61
commit a639f96111
1 changed files with 2 additions and 0 deletions

View File

@ -295,6 +295,8 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)
uint8_t locty = s->cmd.locty;
uint8_t l;
assert(TPM_TIS_IS_VALID_LOCTY(locty));
if (s->cmd.selftest_done) {
for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) {
s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE;