tpm: Disable TPM on tpm2_create_primary() failure
Subsystems (5)
Jarkko Sakkinen
maintainerPATCH 1/1 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.
Reported-by Christoph Anton Mitterer <[email protected]>
Fixes cc7d8594342a ("tpm: Rollback tpm2_load_null()")
Signed-off-by Jarkko Sakkinen <[email protected]>
--- drivers/char/tpm/tpm2-sessions.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm2-sessions.c +5 -2
@@ -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; }/**
Signature · 1 line
2.47.0