Skip to contentSkip to conversation

tpm: fix tpm disabling if NULL name changes

PATCH In review James Bottomley 2 participants 2 messages Mar 13 – Mar 23

Subsystems (2)
lore
Share & tools
lore

James Bottomley

author maintainer
#0 lore raw

PATCH 1/1 tpm: fix tpm disabling if NULL name changes

There's a logic error in the earlier fix which means that if the NULL name comparison fails, the tpm isn't disabled because rc remains zero. Fix this by setting it to an error.

Fixes cc7d8594342a ("tpm: Rollback tpm2_load_null()")

---

I didn't actually discover this problem until I was trying to do a reset attack demo with an updated kernel.

 drivers/char/tpm/tpm2-sessions.c | 1 +
 1 file changed, 1 insertion(+)
drivers/char/tpm/tpm2- renamed from drivers/char/tpm/tpm2-sessions.c +0 -0

sessions.c
index 3b1cf1ca0420..bd1c0456e775 100644

drivers/char/tpm/tpm2-sessions.c +0 -0
@@ -961,6 +961,7 @@ 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);
+ rc = -ENODEV;

err:
if (rc) {

Signature · 1 line
2.51.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · James Bottomley

There's a logic error in the earlier fix which means that if the NULL name comparison fails, the tpm isn't disabled because rc remains zero. Fix this by setting it to an error.

Fixes cc7d8594342a ("tpm: Rollback tpm2_load_null()")

---

I didn't actually discover this problem until I was trying to do a reset attack demo with an updated kernel.

 drivers/char/tpm/tpm2-sessions.c | 1 +
 1 file changed, 1 insertion(+)
drivers/char/tpm/tpm2- renamed from drivers/char/tpm/tpm2-sessions.c +0 -0

sessions.c
index 3b1cf1ca0420..bd1c0456e775 100644

drivers/char/tpm/tpm2-sessions.c +1 -0
@@ -961,6 +961,7 @@ 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);
+	rc = -ENODEV;
 
 err:
Quoted 5 lines

if (rc) {

Signature · 1 line
2.51.0

Possible to resend (fake ancestor)?

Other than that,

BR, Jarkko