]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
tpm: do not ignore memblock_reserve return value
authorGregory Price <gourry@gourry.net>
Fri, 13 Sep 2024 23:19:52 +0000 (19:19 -0400)
committerArd Biesheuvel <ardb@kernel.org>
Tue, 15 Oct 2024 18:27:29 +0000 (20:27 +0200)
tpm code currently ignores a relevant failure case silently.
Add an error to make this failure non-silent.

Signed-off-by: Gregory Price <gourry@gourry.net>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/tpm.c

index 9c3613e6af158f83bf58dab296ef093700c8246d..b0cc2cc11d7e711043ed836d4aeb55ea3b14ae63 100644 (file)
@@ -61,7 +61,12 @@ int __init efi_tpm_eventlog_init(void)
        }
 
        tbl_size = sizeof(*log_tbl) + log_tbl->size;
-       memblock_reserve(efi.tpm_log, tbl_size);
+       if (memblock_reserve(efi.tpm_log, tbl_size)) {
+               pr_err("TPM Event Log memblock reserve fails (0x%lx, 0x%x)\n",
+                      efi.tpm_log, tbl_size);
+               ret = -ENOMEM;
+               goto out;
+       }
 
        if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) {
                pr_info("TPM Final Events table not present\n");