summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2015-06-04 10:19:30 -0400
committerPeter Jones <pjones@redhat.com>2015-06-04 10:19:30 -0400
commit8837b9054f544fd9701cf0bd4b1bd4e596f4c2e7 (patch)
tree1b61e5a51d819b51e5759cc9db36d4c30d96b262
parent80bcb5782352a44fdda0d431e463f977db33d4fb (diff)
downloadefi-boot-shim-8837b9054f544fd9701cf0bd4b1bd4e596f4c2e7.tar.gz
efi-boot-shim-8837b9054f544fd9701cf0bd4b1bd4e596f4c2e7.zip
Only run MokManager if asked or a security violation occurs.
Don't run MokManager on any random error from start_image(second_stage); only try it if it /is/ the second stage, or if start_image gave us EFI_SECURITY_VIOLATION. Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r--shim.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/shim.c b/shim.c
index 5712d480..d66c549c 100644
--- a/shim.c
+++ b/shim.c
@@ -1673,14 +1673,21 @@ done:
EFI_STATUS init_grub(EFI_HANDLE image_handle)
{
EFI_STATUS efi_status;
+ int use_fb = should_use_fallback(image_handle);
- if (should_use_fallback(image_handle))
- efi_status = start_image(image_handle, FALLBACK);
- else
- efi_status = start_image(image_handle, second_stage);
+ efi_status = start_image(image_handle, use_fb ? FALLBACK :second_stage);
- if (efi_status != EFI_SUCCESS)
+ if (efi_status == EFI_SECURITY_VIOLATION) {
efi_status = start_image(image_handle, MOK_MANAGER);
+ if (efi_status != EFI_SUCCESS) {
+ Print(L"start_image() returned %r\n", efi_status);
+ uefi_call_wrapper(BS->Stall, 1, 2000000);
+ return efi_status;
+ }
+
+ efi_status = start_image(image_handle,
+ use_fb ? FALLBACK : second_stage);
+ }
Print(L"start_image() returned %r\n", efi_status);
uefi_call_wrapper(BS->Stall, 1, 2000000);