Skip to content

Commit b02de70

Browse files
committed
libstub,tpm: do not ignore failure case when reading final event log
JIRA: https://issues.redhat.com/browse/RHEL-72764 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git commit 63971b0 Author: Gregory Price <gourry@gourry.net> Date: Fri Sep 13 19:19:54 2024 -0400 libstub,tpm: do not ignore failure case when reading final event log Current code fails to check for an error case when reading events from final event log to calculate offsets. Check the error case, and break early because all subsequent calls will also fail. Signed-off-by: Gregory Price <gourry@gourry.net> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
1 parent ea33466 commit b02de70

File tree

1 file changed

+3
-0
lines changed
  • drivers/firmware/efi/libstub

1 file changed

+3
-0
lines changed

drivers/firmware/efi/libstub/tpm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ static void efi_retrieve_tcg2_eventlog(int version, efi_physical_addr_t log_loca
124124
event_size = __calc_tpm2_event_size(header,
125125
(void *)(long)log_location,
126126
false);
127+
/* If calc fails this is a malformed log */
128+
if (!event_size)
129+
break;
127130
final_events_size += event_size;
128131
i--;
129132
}

0 commit comments

Comments
 (0)