Skip to content
Snippets Groups Projects
Commit 58bc69d2 authored by Alexander Graf's avatar Alexander Graf
Browse files

efi_loader: Allocate memory handle for mem dp


When we boot using memdp (bootefi on an address without previous
load that populates the device path) then the memory device path
we pass in is not backed by any handle.

That can result in weird effects. For example grub gets very grumpy
about this inside the efi_net module and just loops endlessly.

So let's expose a simple handle that the memory device path is backed
on. That way any code that looks for the device the dp is on, finds
one.

Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent 2f61b13d
No related branches found
No related tags found
No related merge requests found
...@@ -263,6 +263,7 @@ static efi_status_t do_bootefi_exec(void *efi, ...@@ -263,6 +263,7 @@ static efi_status_t do_bootefi_exec(void *efi,
{ {
struct efi_loaded_image loaded_image_info = {}; struct efi_loaded_image loaded_image_info = {};
struct efi_object loaded_image_info_obj = {}; struct efi_object loaded_image_info_obj = {};
struct efi_object mem_obj = {};
struct efi_device_path *memdp = NULL; struct efi_device_path *memdp = NULL;
efi_status_t ret; efi_status_t ret;
...@@ -279,6 +280,12 @@ static efi_status_t do_bootefi_exec(void *efi, ...@@ -279,6 +280,12 @@ static efi_status_t do_bootefi_exec(void *efi,
/* actual addresses filled in after efi_load_pe() */ /* actual addresses filled in after efi_load_pe() */
memdp = efi_dp_from_mem(0, 0, 0); memdp = efi_dp_from_mem(0, 0, 0);
device_path = image_path = memdp; device_path = image_path = memdp;
efi_add_handle(&mem_obj);
ret = efi_add_protocol(mem_obj.handle, &efi_guid_device_path,
device_path);
if (ret != EFI_SUCCESS)
goto exit;
} else { } else {
assert(device_path && image_path); assert(device_path && image_path);
} }
...@@ -343,6 +350,8 @@ static efi_status_t do_bootefi_exec(void *efi, ...@@ -343,6 +350,8 @@ static efi_status_t do_bootefi_exec(void *efi,
exit: exit:
/* image has returned, loaded-image obj goes *poof*: */ /* image has returned, loaded-image obj goes *poof*: */
list_del(&loaded_image_info_obj.link); list_del(&loaded_image_info_obj.link);
if (mem_obj.handle)
list_del(&mem_obj.link);
return ret; return ret;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment