On Mon, 14 Sept 2026 at 14:38, Vincent Stehlé <[email protected]> wrote:
>
> The new_instance efi_http_instance structure is allocated with calloc(),
> but it is erroneously freed with efi_free_pool() on the error path.
>
> This can be verified on the sandbox by modifying the code to force the
> allocation of new_instance->handle to fail, and with the following
> command:
>
>   ./u-boot -T -c 'setenv efi_selftest http protocol; bootefi selftest'
>
> This results in the following error message:
>
>   efi_free_pool: illegal free 0x000000001928d470
>
> Fix this by using free() instead.
>
> Fixes: 238e0269d82f ("efi_loader: efi_net: add EFI_HTTP_PROTOCOL")
> Signed-off-by: Vincent Stehlé <[email protected]>
> Cc: Heinrich Schuchardt <[email protected]>
> Cc: Ilias Apalodimas <[email protected]>
> Cc: Tom Rini <[email protected]>
> Cc: Adriano Cordova <[email protected]>
> ---

Reviewed-by: Ilias Apalodimas <[email protected]>
>  lib/efi_loader/efi_http.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_http.c b/lib/efi_loader/efi_http.c
> index 2a606aa441e..d26b2119d6f 100644
> --- a/lib/efi_loader/efi_http.c
> +++ b/lib/efi_loader/efi_http.c
> @@ -404,7 +404,7 @@ static efi_status_t EFIAPI 
> efi_http_service_binding_create_child(
>
>         new_instance->handle = calloc(1, sizeof(struct efi_object));
>         if (!new_instance->handle) {
> -               efi_free_pool((void *)new_instance);
> +               free(new_instance);
>                 ret = EFI_OUT_OF_RESOURCES;
>                 goto failure_to_add_protocol;
>         }
>
> ---
> base-commit: a44f46af0aa17e48572e0d46c0d082886ee353c3
> change-id: 20260914-crazy-972d7c92a81b
>
> Best regards,
> --
> Vincent.
>

Reply via email to