All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] efi_laoder: Call Exit() on return from payload in StartImage()
@ 2018-01-25 23:53 Alexander Graf
  2018-01-26  4:06 ` Heinrich Schuchardt
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Graf @ 2018-01-25 23:53 UTC (permalink / raw)
  To: u-boot

When a UEFI payload just returns instead of calling the Exit() callback,
we handle that in efi_do_enter() and call Exit on its behalf, so that
the loaded_image->exit_status value is correct.

We were missing that logic in StartImage(). Call it there too.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 lib/efi_loader/efi_boottime.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index f5dae40f06..4a36b62828 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1578,8 +1578,13 @@ static efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
 
 	ret = EFI_CALL(entry(image_handle, &systab));
 
-	/* Should usually never get here */
-	return EFI_EXIT(ret);
+	/*
+	 * Usually UEFI applications call Exit() instead of returning.
+	 * But because the world doesn not consist of ponies and unicorns,
+	 * we're happy to emulate that behavior on behalf of a payload
+	 * that forgot.
+	 */
+	return EFI_CALL(systab.boottime->exit(image_handle, ret, 0, NULL));
 }
 
 /*
-- 
2.12.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] efi_laoder: Call Exit() on return from payload in StartImage()
  2018-01-25 23:53 [U-Boot] [PATCH] efi_laoder: Call Exit() on return from payload in StartImage() Alexander Graf
@ 2018-01-26  4:06 ` Heinrich Schuchardt
  0 siblings, 0 replies; 2+ messages in thread
From: Heinrich Schuchardt @ 2018-01-26  4:06 UTC (permalink / raw)
  To: u-boot

On 01/26/2018 12:53 AM, Alexander Graf wrote:

There is a typo in the subject "efi_laoder".

> When a UEFI payload just returns instead of calling the Exit() callback,
> we handle that in efi_do_enter() and call Exit on its behalf, so that
> the loaded_image->exit_status value is correct.
> 
> We were missing that logic in StartImage(). Call it there too.
> 
> Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>   lib/efi_loader/efi_boottime.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index f5dae40f06..4a36b62828 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -1578,8 +1578,13 @@ static efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
>   
>   	ret = EFI_CALL(entry(image_handle, &systab));
>   
> -	/* Should usually never get here */
> -	return EFI_EXIT(ret);
> +	/*
> +	 * Usually UEFI applications call Exit() instead of returning.
> +	 * But because the world doesn not consist of ponies and unicorns,
> +	 * we're happy to emulate that behavior on behalf of a payload
> +	 * that forgot.
> +	 */
> +	return EFI_CALL(systab.boottime->exit(image_handle, ret, 0, NULL));
>   }
>   
>   /*
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-26  4:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-25 23:53 [U-Boot] [PATCH] efi_laoder: Call Exit() on return from payload in StartImage() Alexander Graf
2018-01-26  4:06 ` Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.