diff options
author | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> | 2016-11-19 21:18:28 +0300 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-11-28 02:31:32 +0300 |
commit | 0cf577a03f21a988f6dbe8133d07410967b8489a (patch) | |
tree | b2fe2571cea1f5b9049478303b59a79b8ac0c14f /drivers/char/tpm/tpm_eventlog.c | |
parent | 005451d44ad46623aac8349df15d7c0d1d8914c1 (diff) | |
download | linux-0cf577a03f21a988f6dbe8133d07410967b8489a.tar.xz |
tpm: Fix handling of missing event log
The event log is an optional firmware feature, if the firmware
does not support it then the securityfs files should not be created
and no other notification given.
- Uniformly return -ENODEV from the tpm_bios_log_setup cone if
no event log is detected.
- Check in ACPI if this node was discovered via ACPI.
- Improve the check in OF to make sure there is a parent and to
fail detection if the two log properties are not declared
- Pass through all other error codes instead of filtering just some
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm_eventlog.c')
-rw-r--r-- | drivers/char/tpm/tpm_eventlog.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/char/tpm/tpm_eventlog.c b/drivers/char/tpm/tpm_eventlog.c index 34f0921f0203..c73f88cdeadf 100644 --- a/drivers/char/tpm/tpm_eventlog.c +++ b/drivers/char/tpm/tpm_eventlog.c @@ -368,14 +368,21 @@ static int tpm_read_log(struct tpm_chip *chip) } rc = tpm_read_log_acpi(chip); - if ((rc == 0) || (rc == -ENOMEM)) + if (rc != -ENODEV) return rc; - rc = tpm_read_log_of(chip); - - return rc; + return tpm_read_log_of(chip); } +/* + * tpm_bios_log_setup() - Read the event log from the firmware + * @chip: TPM chip to use. + * + * If an event log is found then the securityfs files are setup to + * export it to userspace, otherwise nothing is done. + * + * Returns -ENODEV if the firmware has no event log. + */ int tpm_bios_log_setup(struct tpm_chip *chip) { const char *name = dev_name(&chip->dev); @@ -386,15 +393,8 @@ int tpm_bios_log_setup(struct tpm_chip *chip) return 0; rc = tpm_read_log(chip); - /* - * read_log failure means event log is not supported except for ENOMEM. - */ - if (rc < 0) { - if (rc == -ENOMEM) - return -ENODEV; - else - return rc; - } + if (rc) + return rc; cnt = 0; chip->bios_dir[cnt] = securityfs_create_dir(name, NULL); |