]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: Check for a valid fw_name before auto generating GUIDs
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Tue, 3 Dec 2024 16:13:37 +0000 (18:13 +0200)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 5 Dec 2024 07:01:33 +0000 (09:01 +0200)
The gen_v5_guid() is a void and does no error checking with pointers
being available etc. Instead it expects all things to be in place to
generate GUIDs. If a board capsule definition is buggy and does not
define the firmware names when enabling capsule updates, the board will
crash trying to bring up the EFI subsystem.

Check for a valid firmware name before generating GUIDs.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_firmware.c

index 6650c2b8071def7bab88beacae84ee046b8795d0..112775daf4c3ede750ec2069d68163fc476df8e9 100644 (file)
@@ -281,6 +281,10 @@ static efi_status_t efi_gen_capsule_guids(void)
        }
 
        for (i = 0; i < update_info.num_images; i++) {
+               if (!fw_array[i].fw_name) {
+                       log_err("fw_name is not defined. Not generating capsule GUIDs\n");
+                       return EFI_INVALID_PARAMETER;
+               }
                gen_v5_guid(&namespace,
                            &fw_array[i].image_type_id,
                            compatible, strlen(compatible),