]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Tue, 20 Nov 2018 18:14:51 +0000 (13:14 -0500)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 2 Apr 2019 01:36:21 +0000 (20:36 -0500)
Make sure that the new locality passed to tpm_tis_prep_abort()
is valid.

Add a comment to aborting_locty that it may be any locality, including
TPM_TIS_NO_LOCALITY.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit e92b63ea610201bd743343fc6b11e6c39c8d3515)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/tpm/tpm_tis.c

index d9322692ee6728e3b05757ec46e629c2832ef1e4..9a795ce96c5523d57c2647a2ed5e54010b5047cf 100644 (file)
@@ -263,7 +263,9 @@ static void tpm_tis_prep_abort(TPMState *s, uint8_t locty, uint8_t newlocty)
 {
     uint8_t busy_locty;
 
-    s->aborting_locty = locty;
+    assert(TPM_TIS_IS_VALID_LOCTY(newlocty));
+
+    s->aborting_locty = locty; /* may also be TPM_TIS_NO_LOCALITY */
     s->next_locty = newlocty;  /* locality after successful abort */
 
     /*