Commit 56672bf52ebf7b9d6de245f7a1bf56679a39093b

Authored by Alexander Graf
1 parent c8df80c514

efi_loader: Call Exit() on return from payload in StartImage()

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>

Showing 1 changed file with 7 additions and 2 deletions Side-by-side Diff

lib/efi_loader/efi_boottime.c
... ... @@ -1578,8 +1578,13 @@
1578 1578  
1579 1579 ret = EFI_CALL(entry(image_handle, &systab));
1580 1580  
1581   - /* Should usually never get here */
1582   - return EFI_EXIT(ret);
  1581 + /*
  1582 + * Usually UEFI applications call Exit() instead of returning.
  1583 + * But because the world doesn not consist of ponies and unicorns,
  1584 + * we're happy to emulate that behavior on behalf of a payload
  1585 + * that forgot.
  1586 + */
  1587 + return EFI_CALL(systab.boottime->exit(image_handle, ret, 0, NULL));
1583 1588 }
1584 1589  
1585 1590 /*