Skip to content

Commit 01fc5e8

Browse files
author
Jarkko Sakkinen
committed
tpm: check for TPM_CHIP_FLAG_TPM2 before calling tpm2_shutdown()
Fixes: 20e0152 ("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>
1 parent 0af6e0a commit 01fc5e8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/char/tpm/tpm-chip.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ static void tpm_del_char_device(struct tpm_chip *chip)
269269

270270
/* Make the driver uncallable. */
271271
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);
273274
chip->ops = NULL;
274275
up_write(&chip->ops_sem);
275276
}

0 commit comments

Comments
 (0)