Skip to contentSkip to conversation

tpm: Don't make log failures fatal

PATCH Superseded Matthew Garrett 4 participants 4 messages Dec 13, 2019 – Jan 2, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: Don't make log failures fatal

If a TPM is in disabled state, it's reasonable for it to have an empty log. Bailing out of probe in this case means that the PPI interface isn't available, so there's no way to then enable the TPM from the OS. In general it seems reasonable to ignore log errors - they shouldn't itnerfere with any other TPM functionality.

---
 drivers/char/tpm/tpm-chip.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/char/tpm/tpm-chip.c +1 -3
index 3d6d394a8661..58073836b555 100644
@@ -596,9 +596,7 @@ int tpm_chip_register(struct tpm_chip *chip)
 
 	tpm_sysfs_add_device(chip);
 
-	rc = tpm_bios_log_setup(chip);
-	if (rc != 0 && rc != -ENODEV)
-		return rc;
+	tpm_bios_log_setup(chip);
 
 	tpm_add_ppi(chip);
 
Signature · 1 line
2.24.1.735.g03f4e72817-goog
#1 lore raw
Quoted 8 lines · Matthew Garrett

If a TPM is in disabled state, it's reasonable for it to have an empty log. Bailing out of probe in this case means that the PPI interface isn't available, so there's no way to then enable the TPM from the OS. In general it seems reasonable to ignore log errors - they shouldn't itnerfere with any other TPM functionality.

Otherwise looks great but maybe it would make sense to change tpm_bios_log_setup() as void as part of the change?

Quoted 9 lines
---
 drivers/char/tpm/tpm-chip.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/char/tpm/tpm-chip.c +0 -0
index 3d6d394a8661..58073836b555 100644

drivers/char/tpm/tpm-chip.c int tpm_chip_register(struct tpm_chip *chip) · line 602

Quoted 10 lines
drivers/char/tpm/tpm-chip.c +1 -3
@@ -596,9 +596,7 @@ int tpm_chip_register(struct tpm_chip *chip)
 
 	tpm_sysfs_add_device(chip);
 
-	rc = tpm_bios_log_setup(chip);
-	if (rc != 0 && rc != -ENODEV)
-		return rc;
+	tpm_bios_log_setup(chip);
 
 	tpm_add_ppi(chip);
 

/Jarkko

Acked-by on v1 1/1
#2 lore raw
In reply to Matthew Garrett

Dear Matthew,

Am 13.12.19 um 23:57 schrieb Matthew Garrett:

Quoted 5 lines

If a TPM is in disabled state, it's reasonable for it to have an empty log. Bailing out of probe in this case means that the PPI interface isn't available, so there's no way to then enable the TPM from the OS. In general it seems reasonable to ignore log errors - they shouldn't itnerfere with any other TPM functionality.

interfere

Can this be tested with QEMU somehow?

Quoted 11 lines
---
  drivers/char/tpm/tpm-chip.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/char/tpm/tpm-chip.c +0 -0
index 3d6d394a8661..58073836b555 100644

drivers/char/tpm/tpm-chip.c int tpm_chip_register(struct tpm_chip *chip) · line 601

Quoted 9 lines
drivers/char/tpm/tpm-chip.c +1 -3
@@ -596,9 +596,7 @@ int tpm_chip_register(struct tpm_chip *chip)
 
  	tpm_sysfs_add_device(chip);
 
-	rc = tpm_bios_log_setup(chip);
-	if (rc != 0 && rc != -ENODEV)
-		return rc;
+	tpm_bios_log_setup(chip);
 
  	tpm_add_ppi(chip);

Kind regards,

Paul

#3 lore raw
Quoted 10 lines · Paul Menzel

Am 13.12.19 um 23:57 schrieb Matthew Garrett:

Quoted 5 lines

If a TPM is in disabled state, it's reasonable for it to have an empty log. Bailing out of probe in this case means that the PPI interface isn't available, so there's no way to then enable the TPM from the OS. In general it seems reasonable to ignore log errors - they shouldn't itnerfere with any other TPM functionality.

interfere

Can this be tested with QEMU somehow?

I think you could hack ovmf to disable the event log, but I can't think of a trivial test otherwise.