diff options
author | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-04-25 05:20:07 -0400 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-06-25 10:26:35 -0400 |
commit | c0dff1f4519e3b3c322415b822724d4207156859 (patch) | |
tree | 3f2f2897be4dce9f1c5c11191dc2e4f93e5cab3c | |
parent | 422eac3f7deae34dbaffd08e03e27f37a5394a56 (diff) |
tpm: check for TPM_CHIP_FLAG_TPM2 before calling tpm2_shutdown()
Fixes: 20e0152393b41 ("tpm: fix crash in tpm_tis deinitialization")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reported-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
-rw-r--r-- | drivers/char/tpm/tpm-chip.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 5bc530ccbb86..2ea2f1561e59 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c | |||
@@ -269,7 +269,8 @@ static void tpm_del_char_device(struct tpm_chip *chip) | |||
269 | 269 | ||
270 | /* Make the driver uncallable. */ | 270 | /* Make the driver uncallable. */ |
271 | down_write(&chip->ops_sem); | 271 | down_write(&chip->ops_sem); |
272 | tpm2_shutdown(chip, TPM2_SU_CLEAR); | 272 | if (chip->flags & TPM_CHIP_FLAG_TPM2) |
273 | tpm2_shutdown(chip, TPM2_SU_CLEAR); | ||
273 | chip->ops = NULL; | 274 | chip->ops = NULL; |
274 | up_write(&chip->ops_sem); | 275 | up_write(&chip->ops_sem); |
275 | } | 276 | } |