Skip to content

Commit

Permalink
libstub,tpm: do not ignore failure case when reading final event log
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gregory Price authored and Ard Biesheuvel committed Oct 15, 2024
1 parent a066397 commit 63971b0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/firmware/efi/libstub/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ static void efi_retrieve_tcg2_eventlog(int version, efi_physical_addr_t log_loca
event_size = __calc_tpm2_event_size(header,
(void *)(long)log_location,
false);
/* If calc fails this is a malformed log */
if (!event_size)
break;
final_events_size += event_size;
i--;
}
Expand Down

0 comments on commit 63971b0

Please sign in to comment.