Skip to contentSkip to conversation

efi_loader: Revert device_handle to disk after net boot

PATCH Applied Alexander Graf 1 participant 2 messages Oct 18, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi_loader: Revert device_handle to disk after net boot

When you boot an efi payload from network, then exit that payload and load another payload from disk afterwords, the disk payload will currently see the network device as its boot path.

This breaks grub2 for example which tries to find its modules based on the path it was loaded from.

This patch fixes that issue by always reverting to disk paths if we're not in the network boot. That way the data structures after a network boot look the same as before.

---
 cmd/bootefi.c | 2 ++
 1 file changed, 2 insertions(+)
cmd/bootefi.c +2 -0
index 32148d7..a9910d7 100644
@@ -207,6 +207,8 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
 
 	if (!memcmp(bootefi_device_path[0].str, "N\0e\0t", 6))
 		loaded_image_info.device_handle = nethandle;
+	else
+		loaded_image_info.device_handle = bootefi_device_path;
 #endif
 #ifdef CONFIG_GENERATE_SMBIOS_TABLE
 	efi_smbios_register();
Signature · 1 line
1.8.5.6
author Applied
#1 lore raw
Quoted 4 lines

When you boot an efi payload from network, then exit that payload and load another payload from disk afterwords, the disk payload will currently see the network device as its boot path.

Quoted 8 lines

This breaks grub2 for example which tries to find its modules based on the path it was loaded from.

This patch fixes that issue by always reverting to disk paths if we're not in the network boot. That way the data structures after a network boot look the same as before.

Thanks, applied to efi-next

Alex