From: Stefan Berger Date: Tue, 4 Dec 2018 14:54:39 +0000 (-0500) Subject: tpm: Make sure the locality received from backend is valid X-Git-Tag: v3.1.1~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fe87edd5edc594b2b5247ebc44e98721c0d01e2a;p=thirdparty%2Fqemu.git 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 Reviewed-by: Marc-André Lureau (cherry picked from commit a639f96111eadb3b8e3021fd3f27e2948ad1c640) Signed-off-by: Michael Roth --- diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index 9a795ce96c5..15540267883 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -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;