From: Heinrich Schuchardt Date: Sat, 5 Apr 2025 06:58:12 +0000 (+0200) Subject: efi_loader: stop network in EXIT_BOOT_SERVICES X-Git-Tag: v2025.04~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0efe8ea57fc7a1a6fc5f64fb3cf6bc4a1a4fc219;p=thirdparty%2Fu-boot.git efi_loader: stop network in EXIT_BOOT_SERVICES It has been reported that memory corruption can occurred because network packages where received after EXIT_BOOT_SERVICES. See the thread starting at [1]. We try to remove all drivers when EXIT_BOOT_SERVICES is called. But * Some network drivers don't call their own stop method when removed. * Some network drivers don't have a remove method. * Some devices have CONFIG_DM_DEVICE_REMOVE=n. Let's call eth_halt() in EXIT_BOOT_SERVICES explicitly. [1] https://lore.kernel.org/all/C101B675-EEE6-44CB-8A44-83F72182FBD6@kohlschutter.com/ Cc: Michael Brown Reported-by: Christian Kohlschütter Signed-off-by: Heinrich Schuchardt Reviewed-by: Michael Brown Reviewed-by: Ilias Apalodimas Tested-by: Christian Kohlschütter --- diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 5164cb15986..eaa6464fa39 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -2235,6 +2236,8 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, bootm_disable_interrupts(); if (IS_ENABLED(CONFIG_USB_DEVICE)) udc_disconnect(); + if (IS_ENABLED(CONFIG_DM_ETH)) + eth_halt(); board_quiesce_devices(); dm_remove_devices_active(); }