]> www.infradead.org Git - users/dwmw2/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, 1 Oct 2019 21:58:28 +0000 (16:58 -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 3087acc4ab7ea6a788483f2518c3f73fd55de003..55ea74f3ba0f7e354f41680ae790ccc61b6e381e 100644 (file)
@@ -273,7 +273,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 fd183e8deb08a6769443a977766a163d03a4373d..4203da10081f10ef15d1faea01ff9f34092df509 100644 (file)
@@ -909,7 +909,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 */