summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm2-space.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tpm/tpm2-space.c')
-rw-r--r--drivers/char/tpm/tpm2-space.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c
index 8a8754a0f964..6cc7bb442162 100644
--- a/drivers/char/tpm/tpm2-space.c
+++ b/drivers/char/tpm/tpm2-space.c
@@ -60,7 +60,10 @@ int tpm2_init_space(struct tpm_space *space)
void tpm2_del_space(struct tpm_chip *chip, struct tpm_space *space)
{
mutex_lock(&chip->tpm_mutex);
- tpm2_flush_sessions(chip, space);
+ if (!tpm_chip_start(chip, 0)) {
+ tpm2_flush_sessions(chip, space);
+ tpm_chip_stop(chip, 0);
+ }
mutex_unlock(&chip->tpm_mutex);
kfree(space->context_buf);
kfree(space->session_buf);