Skip to content

Commit 423893f

Browse files
committed
tpm: Disable TPM on tpm2_create_primary() failure
The earlier bug fix misplaced the error-label when dealing with the tpm2_create_primary() return value, which the original completely ignored. Cc: [email protected] Reported-by: Christoph Anton Mitterer <[email protected]> Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1087331 Fixes: cc7d859 ("tpm: Rollback tpm2_load_null()") Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent 27184f8 commit 423893f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/char/tpm/tpm2-sessions.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,10 +953,13 @@ static int tpm2_load_null(struct tpm_chip *chip, u32 *null_key)
953953
/* Deduce from the name change TPM interference: */
954954
dev_err(&chip->dev, "null key integrity check failed\n");
955955
tpm2_flush_context(chip, tmp_null_key);
956-
chip->flags |= TPM_CHIP_FLAG_DISABLE;
957956

958957
err:
959-
return rc ? -ENODEV : 0;
958+
if (rc) {
959+
chip->flags |= TPM_CHIP_FLAG_DISABLE;
960+
rc = -ENODEV;
961+
}
962+
return rc;
960963
}
961964

962965
/**

0 commit comments

Comments
 (0)