summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_capsule.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-08-03 12:43:24 -0400
committerTom Rini <trini@konsulko.com>2023-08-03 12:43:24 -0400
commit6cdd4b8108f57252b8849e71aa46e3a2d227c98d (patch)
tree7a1d67347f0fad4eef0a0c95f35dedd866e714aa /lib/efi_loader/efi_capsule.c
parent8b572a387ea907452b4269f9ec9f8321229bd8ec (diff)
parentcd87d2c61ce8e8e963de514f2c8ab0f959d6b586 (diff)
Merge tag 'efi-2023-10-rc2-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2023-10-rc2-2 Documentation: * Move README.falcon to HTML * Describe usage of QEMU virtio block device * Add SPDX license identifiers to svg images * Add more detail to the description of U-Boot boot phases UEFI: * Fix buffer overflows * Fix memory leak in efi_add_memory_map_pg * Properly check return values of calloc, uuid_str_to_bin, efi_parse_pkcs7_header
Diffstat (limited to 'lib/efi_loader/efi_capsule.c')
-rw-r--r--lib/efi_loader/efi_capsule.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 7a6f195cbc0..af8a2ee940c 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -368,9 +368,8 @@ efi_status_t efi_capsule_authenticate(const void *capsule, efi_uintn_t capsule_s
auth_hdr->auth_info.hdr.dwLength
- sizeof(auth_hdr->auth_info),
&buf);
- if (IS_ERR(capsule_sig)) {
+ if (!capsule_sig) {
debug("Parsing variable's pkcs7 header failed\n");
- capsule_sig = NULL;
goto out;
}
@@ -581,6 +580,13 @@ static efi_status_t efi_capsule_update_firmware(
fw_accept_os = capsule_data->flags & FW_ACCEPT_OS ? 0x1 : 0x0;
}
+ if (guidcmp(&capsule_data->capsule_guid,
+ &efi_guid_firmware_management_capsule_id)) {
+ log_err("Unsupported capsule type: %pUs\n",
+ &capsule_data->capsule_guid);
+ return EFI_UNSUPPORTED;
+ }
+
/* sanity check */
if (capsule_data->header_size < sizeof(*capsule) ||
capsule_data->header_size >= capsule_data->capsule_image_size)
@@ -751,15 +757,7 @@ efi_status_t EFIAPI efi_update_capsule(
log_debug("Capsule[%d] (guid:%pUs)\n",
i, &capsule->capsule_guid);
- if (!guidcmp(&capsule->capsule_guid,
- &efi_guid_firmware_management_capsule_id)) {
- ret = efi_capsule_update_firmware(capsule);
- } else {
- log_err("Unsupported capsule type: %pUs\n",
- &capsule->capsule_guid);
- ret = EFI_UNSUPPORTED;
- }
-
+ ret = efi_capsule_update_firmware(capsule);
if (ret != EFI_SUCCESS)
goto out;
}