Skip to content

Commit

Permalink
tpm: Disable TPM on tpm2_create_primary() failure
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jarkkojs committed Nov 13, 2024
1 parent 27184f8 commit 423893f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/char/tpm/tpm2-sessions.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,10 +953,13 @@ static int tpm2_load_null(struct tpm_chip *chip, u32 *null_key)
/* Deduce from the name change TPM interference: */
dev_err(&chip->dev, "null key integrity check failed\n");
tpm2_flush_context(chip, tmp_null_key);
chip->flags |= TPM_CHIP_FLAG_DISABLE;

err:
return rc ? -ENODEV : 0;
if (rc) {
chip->flags |= TPM_CHIP_FLAG_DISABLE;
rc = -ENODEV;
}
return rc;
}

/**
Expand Down

0 comments on commit 423893f

Please sign in to comment.