forked from Minki/linux
e658c82be5
If __calc_tpm2_event_size() fails to parse an event it will return 0,
resulting tpm2_calc_event_log_size() returning -1. Currently there is
no check of this return value, and 'efi_tpm_final_log_size' can end up
being set to this negative value resulting in a crash like this one:
BUG: unable to handle page fault for address: ffffbc8fc00866ad
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
RIP: 0010:memcpy_erms+0x6/0x10
Call Trace:
tpm_read_log_efi()
tpm_bios_log_setup()
tpm_chip_register()
tpm_tis_core_init.cold.9+0x28c/0x466
tpm_tis_plat_probe()
platform_drv_probe()
...
Also __calc_tpm2_event_size() returns a size of 0 when it fails
to parse an event, so update function documentation to reflect this.
The root cause of the issue that caused the failure of event parsing
in this case is resolved by Peter Jone's patchset dealing with large
event logs where crossing over a page boundary causes the page with
the event count to be unmapped.
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ben Dooks <ben.dooks@codethink.co.uk>
Cc: Dave Young <dyoung@redhat.com>
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Matthew Garrett <mjg59@google.com>
Cc: Octavian Purdila <octavian.purdila@intel.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Scott Talbert <swt@techie.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Cc: linux-integrity@vger.kernel.org
Cc: stable@vger.kernel.org
Fixes:
|
||
---|---|---|
.. | ||
arm_scmi | ||
broadcom | ||
efi | ||
imx | ||
meson | ||
psci | ||
tegra | ||
xilinx | ||
arm_scpi.c | ||
arm_sdei.c | ||
dmi_scan.c | ||
dmi-id.c | ||
dmi-sysfs.c | ||
edd.c | ||
iscsi_ibft_find.c | ||
iscsi_ibft.c | ||
Kconfig | ||
Makefile | ||
memmap.c | ||
pcdp.c | ||
pcdp.h | ||
qcom_scm-32.c | ||
qcom_scm-64.c | ||
qcom_scm.c | ||
qcom_scm.h | ||
qemu_fw_cfg.c | ||
raspberrypi.c | ||
scpi_pm_domain.c | ||
stratix10-rsu.c | ||
stratix10-svc.c | ||
ti_sci.c | ||
ti_sci.h | ||
trusted_foundations.c | ||
turris-mox-rwtm.c |