Skip to content

Commit 805fa88

Browse files
Matthew GarrettJarkko Sakkinen
authored andcommitted
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 interfere with any other TPM functionality. Signed-off-by: Matthew Garrett <matthewgarrett@google.com> Cc: stable@vger.kernel.org # 4.19.x Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
1 parent 0d81a3f commit 805fa88

3 files changed

Lines changed: 6 additions & 12 deletions

File tree

‎drivers/char/tpm/eventlog/common.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,8 @@ static int tpm_read_log(struct tpm_chip *chip)
9999
*
100100
* If an event log is found then the securityfs files are setup to
101101
* export it to userspace, otherwise nothing is done.
102-
*
103-
* Returns -ENODEV if the firmware has no event log or securityfs is not
104-
* supported.
105102
*/
106-
int tpm_bios_log_setup(struct tpm_chip *chip)
103+
void tpm_bios_log_setup(struct tpm_chip *chip)
107104
{
108105
const char *name = dev_name(&chip->dev);
109106
unsigned int cnt;
@@ -112,7 +109,7 @@ int tpm_bios_log_setup(struct tpm_chip *chip)
112109

113110
rc = tpm_read_log(chip);
114111
if (rc < 0)
115-
return rc;
112+
return;
116113
log_version = rc;
117114

118115
cnt = 0;
@@ -158,13 +155,12 @@ int tpm_bios_log_setup(struct tpm_chip *chip)
158155
cnt++;
159156
}
160157

161-
return 0;
158+
return;
162159

163160
err:
164-
rc = PTR_ERR(chip->bios_dir[cnt]);
165161
chip->bios_dir[cnt] = NULL;
166162
tpm_bios_log_teardown(chip);
167-
return rc;
163+
return;
168164
}
169165

170166
void tpm_bios_log_teardown(struct tpm_chip *chip)

‎drivers/char/tpm/tpm-chip.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,7 @@ int tpm_chip_register(struct tpm_chip *chip)
596596

597597
tpm_sysfs_add_device(chip);
598598

599-
rc = tpm_bios_log_setup(chip);
600-
if (rc != 0 && rc != -ENODEV)
601-
return rc;
599+
tpm_bios_log_setup(chip);
602600

603601
tpm_add_ppi(chip);
604602

‎drivers/char/tpm/tpm.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u8 *cmd,
235235
int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, void *buf,
236236
size_t *bufsiz);
237237

238-
int tpm_bios_log_setup(struct tpm_chip *chip);
238+
void tpm_bios_log_setup(struct tpm_chip *chip);
239239
void tpm_bios_log_teardown(struct tpm_chip *chip);
240240
int tpm_dev_common_init(void);
241241
void tpm_dev_common_exit(void);

0 commit comments

Comments
 (0)