From: Stefan Berger Date: Thu, 25 Jul 2019 10:29:39 +0000 (-0400) Subject: tpm: Exit in reset when backend indicates failure X-Git-Tag: v3.1.1~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=51ce84e119541e7a3cf8922c9f87de7787b8de91;p=thirdparty%2Fqemu.git tpm: Exit in reset when backend indicates failure Exit() in the frontend reset function when the backend indicates intialization failure. Signed-off-by: Stefan Berger Reviewed-by: Marc-André Lureau (cherry picked from commit bcfd16fe26d6bb6eabfd2dfb46b9fda59d5493db) Signed-off-by: Michael Roth --- diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c index a92dd50437b..e062f597f9e 100644 --- a/hw/tpm/tpm_crb.c +++ b/hw/tpm/tpm_crb.c @@ -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) diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index fb08b483bc0..dd6a0c4969d 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -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 */