Message ID | 20241203161338.1814537-1-ilias.apalodimas@linaro.org |
---|---|
State | Accepted |
Commit | 05396fb724551e57ccf6de15ce9f4c0e3128f82c |
Headers | show |
Series | efi_loader: Check for a valid fw_name before auto generating GUIDs | expand |
On 12/3/24 17:13, Ilias Apalodimas wrote: > 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. > > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > --- > lib/efi_loader/efi_firmware.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c > index 6650c2b8071d..112775daf4c3 100644 > --- a/lib/efi_loader/efi_firmware.c > +++ b/lib/efi_loader/efi_firmware.c > @@ -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), > - > 2.45.2 >
On 03/12/2024 17:13, Ilias Apalodimas wrote: > 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. > > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> > --- > lib/efi_loader/efi_firmware.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c > index 6650c2b8071d..112775daf4c3 100644 > --- a/lib/efi_loader/efi_firmware.c > +++ b/lib/efi_loader/efi_firmware.c > @@ -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), > - > 2.45.2 >
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index 6650c2b8071d..112775daf4c3 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -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),
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. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> --- lib/efi_loader/efi_firmware.c | 4 ++++ 1 file changed, 4 insertions(+) - 2.45.2