From 38b16b200c10cc13c755481884484435dd45d5d3 Mon Sep 17 00:00:00 2001 From: Tamas K Lengyel Date: Sun, 31 Dec 2017 11:03:26 -0700 Subject: shim: Don't overwrite EFI_LOADED_IMAGE's LoadOptions when not needed When the firmware is using EFI_LOAD_OPTION to specify options for the secondary loader, the shim will properly detect that and return in set_second_stage. Later howerer in handle_image EFI_LOADED_IMAGE is being overwritten with load_option irrespective of the fact that load_option was never set. This effectively prevents the EFI_LOAD_OPTION from reaching the secondary loader. Only overwrite EFI_LOADED_IMAGE's LoadOptions when load_option is not NULL solves the problem. Signed-off-by: Tamas K Lengyel --- shim.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'shim.c') diff --git a/shim.c b/shim.c index 530b545d..569a6084 100644 --- a/shim.c +++ b/shim.c @@ -1441,8 +1441,10 @@ static EFI_STATUS handle_image (void *data, unsigned int datasize, li->ImageSize = context.ImageSize; /* Pass the load options to the second stage loader */ - li->LoadOptions = load_options; - li->LoadOptionsSize = load_options_size; + if ( load_options ) { + li->LoadOptions = load_options; + li->LoadOptionsSize = load_options_size; + } if (!found_entry_point) { perror(L"Entry point is not within sections\n"); -- cgit v1.2.3