Skip to contentSkip to conversation

tpm: check for TPM_CHIP_FLAG_TPM2 before calling tpm2_shutdown()

PATCH In review Jarkko Sakkinen 3 participants 4 messages Apr 25, 2016 TPM device driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: check for TPM_CHIP_FLAG_TPM2 before calling tpm2_shutdown()

---
 drivers/char/tpm/tpm-chip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm-chip.c +2 -1
index a12db8e..1965dc7 100644
@@ -270,7 +270,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);
 }
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jarkko Sakkinen
 drivers/char/tpm/tpm-chip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Fixes 20e0152393b41 ("tpm: fix crash in tpm_tis deinitialization")

drivers/char/tpm/tpm-chip.c static void tpm_del_char_device(struct tpm_chip *chip) · line 277

Quoted 13 lines
drivers/char/tpm/tpm-chip.c +3 -1
index a12db8e..1965dc7 100644
+++ b/drivers/char/tpm/tpm-chip.c
@@ -270,7 +270,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);
 }

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z

#2 lore raw
Quoted 8 lines · Jason Gunthorpe
Quoted 4 lines · Jarkko Sakkinen
 drivers/char/tpm/tpm-chip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Fixes 20e0152393b41 ("tpm: fix crash in tpm_tis deinitialization")

Thanks and thanks for the fixes line (forgot to add it) :)

/Jarkko

Quoted 14 lines
Quoted 13 lines
drivers/char/tpm/tpm-chip.c +3 -1
index a12db8e..1965dc7 100644
+++ b/drivers/char/tpm/tpm-chip.c
@@ -270,7 +270,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);
 }
Tested-by
#3 lore raw
In reply to Jason Gunthorpe
Quoted 7 lines · Jason Gunthorpe
Quoted 4 lines · Jarkko Sakkinen
  drivers/char/tpm/tpm-chip.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Fixes 20e0152393b41 ("tpm: fix crash in tpm_tis deinitialization")

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z