On 11/22/18 9:50 PM, Simon Glass wrote:
> Hi Heinrich,
> 
> On Mon, 19 Nov 2018 at 12:41, Heinrich Schuchardt <xypron.g...@gmx.de> wrote:
>>
>> On 11/15/18 12:11 AM, Simon Glass wrote:
>>> This function can be used from do_bootefi_exec() so that we use mostly the
>>> same code for a normal EFI application and an EFI test.
>>>
>>> Rename the function and use it in both places.
>>>
>>> Signed-off-by: Simon Glass <s...@chromium.org>
>>> ---
>>>
>>> Changes in v14:
>>> - Go back to the horrible long variable names
>>> - Hopefully correct error paths in do_bootefi_exec()
>>>
>>> Changes in v13:
>>> - Drop 'efi_loader: Drop setup_ok' as we have an existing patch for that
>>> - Drop patches previously applied
>>>
>>> Changes in v12: None
>>> Changes in v11:
>>> - Drop patches previously applied
>>>
>>> Changes in v9: None
>>> Changes in v7:
>>> - Drop patch "efi: Init the 'rows' and 'cols' variables"
>>> - Drop patches previous applied
>>>
>>> Changes in v5:
>>> - Rebase to master
>>>
>>> Changes in v4:
>>> - Rebase to master
>>>
>>> Changes in v3:
>>> - Add new patch to rename bootefi_test_finish() to bootefi_run_finish()
>>>
>>>  cmd/bootefi.c | 46 ++++++++++++++++++++++++----------------------
>>>  1 file changed, 24 insertions(+), 22 deletions(-)
>>>
>>> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
>>> index ab7ada9f2d6..a627f689f95 100644
>>> --- a/cmd/bootefi.c
>>> +++ b/cmd/bootefi.c
>>> @@ -350,6 +350,20 @@ static efi_status_t bootefi_run_prepare(const char 
>>> *load_options_path,
>>>       return 0;
>>>  }
>>>
>>> +/**
>>> + * bootefi_run_finish() - finish up after running an EFI test
>>> + *
>>> + * @loaded_image_info: Pointer to a struct which holds the loaded image 
>>> info
>>> + * @image_objj: Pointer to a struct which holds the loaded image object
>>> + */
>>> +static void bootefi_run_finish(struct efi_loaded_image_obj *image_obj,
>>> +                            struct efi_loaded_image *loaded_image_info)
>>> +{
>>> +     efi_restore_gd();
>>> +     free(loaded_image_info->load_options);
>>> +     efi_delete_handle(&image_obj->header);
>>> +}
>>> +
>>>  /**
>>>   * do_bootefi_exec() - execute EFI binary
>>>   *
>>> @@ -390,11 +404,11 @@ static efi_status_t do_bootefi_exec(void *efi,
>>>                */
>>>               ret = efi_create_handle(&mem_handle);
>>>               if (ret != EFI_SUCCESS)
>>> -                     goto exit;
>>
>> You are leaking a device path.
> 
> I cannot see anywhere where these are freed. Are you sure this is supported?

According to the UEFI standard handles are deleted when the last
protocol is removed. See efi_uninstall_protocol_interface(). I am aware
that our cleanup after running binaries is still incomplete.

In this function you could use efi_delete_handle() in the error handler.

Regards

Heinrich

> 
> I'll add a comment for now. In any case, this matches the previous code.
> 
> Regards,
> Simon
> 

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to