]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tpm: Exit in reset when backend indicates failure
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Thu, 25 Jul 2019 10:29:39 +0000 (06:29 -0400)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 30 Jul 2019 16:39:27 +0000 (11:39 -0500)
Exit() in the frontend reset function when the backend indicates
intialization failure.

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

index a92dd50437b1e9eaec22b43f526882a801c0f38a..e062f597f9e3a55b06b2585c817c46e614b4d448 100644 (file)
@@ -265,7 +265,9 @@ static void tpm_crb_reset(void *dev)
     s->be_buffer_size = MIN(tpm_backend_get_buffer_size(s->tpmbe),
                             CRB_CTRL_CMD_SIZE);
 
-    tpm_backend_startup_tpm(s->tpmbe, s->be_buffer_size);
+    if (tpm_backend_startup_tpm(s->tpmbe, s->be_buffer_size) < 0) {
+        exit(1);
+    }
 }
 
 static void tpm_crb_realize(DeviceState *dev, Error **errp)
index fb08b483bc0437d87bf1dfafd2dbbe23d21082ee..dd6a0c4969dd55641b4631bf6f4895d8816c5e15 100644 (file)
@@ -895,7 +895,9 @@ static void tpm_tis_reset(DeviceState *dev)
         s->rw_offset = 0;
     }
 
-    tpm_backend_startup_tpm(s->be_driver, s->be_buffer_size);
+    if (tpm_backend_startup_tpm(s->be_driver, s->be_buffer_size) < 0) {
+        exit(1);
+    }
 }
 
 /* persistent state handling */