Rework the code that loads the initrd via LoadFile2 so that it looks for the protocol on the loaded image handle first, and only if it doesn't find it here, on the global singleton device path. This works around reported issues where intermediate loader stages are providing an initrd via this mechanism, and subsequently loading another intermediate boot stage that does the same. Link: https://github.com/systemd/systemd/issues/26723 Cc: Michael Brown <mcb30@xxxxxxxx> Cc: Ilias Apalodimas <ilias.apalodimas@xxxxxxxxxx> Ard Biesheuvel (2): efi: libstub: Pass loaded image EFI handle to efi_load_initrd() efi: libstub: Look for initrd LoadFile2 protocol on image handle drivers/firmware/efi/libstub/efi-stub-helper.c | 45 ++++++++++++-------- drivers/firmware/efi/libstub/efi-stub.c | 4 +- drivers/firmware/efi/libstub/efistub.h | 3 +- drivers/firmware/efi/libstub/x86-stub.c | 4 +- include/linux/efi.h | 2 +- include/linux/pe.h | 2 +- 6 files changed, 36 insertions(+), 24 deletions(-) -- 2.39.2