From: Jarkko Sakkinen Date: Mon, 25 Apr 2016 09:20:07 +0000 (+0300) Subject: tpm: check for TPM_CHIP_FLAG_TPM2 before calling tpm2_shutdown() X-Git-Tag: v4.14-rc1~2771^2~73 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0dff1f4519e3b3c322415b822724d4207156859;p=platform%2Fkernel%2Flinux-rpi.git 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 Reported-by: Stefan Berger Tested-by: Stefan Berger Reviewed-By: Jason Gunthorpe --- diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 5bc530c..2ea2f15 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) /* Make the driver uncallable. */ down_write(&chip->ops_sem); - tpm2_shutdown(chip, TPM2_SU_CLEAR); + if (chip->flags & TPM_CHIP_FLAG_TPM2) + tpm2_shutdown(chip, TPM2_SU_CLEAR); chip->ops = NULL; up_write(&chip->ops_sem); }