]> Git Repo - linux.git/commitdiff
tpm: Disable TPM on tpm2_create_primary() failure
authorJarkko Sakkinen <[email protected]>
Wed, 13 Nov 2024 18:35:39 +0000 (20:35 +0200)
committerJarkko Sakkinen <[email protected]>
Wed, 13 Nov 2024 19:10:45 +0000 (21:10 +0200)
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: cc7d8594342a ("tpm: Rollback tpm2_load_null()")
Signed-off-by: Jarkko Sakkinen <[email protected]>
drivers/char/tpm/tpm2-sessions.c

index 52d3523042fb8238bbd20a0ad195bfa916c49897..b0f13c8ea79c7a95fb3315cb5f5f6729feb90445 100644 (file)
@@ -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;
 }
 
 /**
This page took 0.055855 seconds and 4 git commands to generate.