Re: [PATCH 08/15] efi/x86: Move command-line initrd loading to efi_main

From: Arvind Sankar
Date: Wed May 27 2020 - 18:47:03 EST


On Wed, May 27, 2020 at 10:30:18PM +0000, Williams, Dan J wrote:
> On Fri, 2020-05-08 at 20:01 +0200, Ard Biesheuvel wrote:
> > From: Arvind Sankar <nivedita@xxxxxxxxxxxx>
> >
> > Consolidate the initrd loading in efi_main.
> >
> > The command line options now need to be parsed only once.
> >
> > Signed-off-by: Arvind Sankar <nivedita@xxxxxxxxxxxx>
> > Link:
> > https://lore.kernel.org/r/20200430182843.2510180-9-nivedita@xxxxxxxxxxxx
> > Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
>
> Hi,
>
> This patch patch in tip/master as:
>
> 987053a30016 efi/x86: Move command-line initrd loading to efi_main
>
> ...regresses my nfs root configuration. It hangs trying to mount the
> nfs root filesystem "root=/dev/nfs ip=dhcp".
>
> It does not revert cleanly.
>
>

Does this fix it?

diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index defeb6035109..f53362efef84 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -771,10 +771,12 @@ unsigned long efi_main(efi_handle_t handle,
efi_err("Failed to load initrd!\n");
goto fail;
}
- efi_set_u64_split(addr, &hdr->ramdisk_image,
- &boot_params->ext_ramdisk_image);
- efi_set_u64_split(size, &hdr->ramdisk_size,
- &boot_params->ext_ramdisk_size);
+ if (size > 0) {
+ efi_set_u64_split(addr, &hdr->ramdisk_image,
+ &boot_params->ext_ramdisk_image);
+ efi_set_u64_split(size, &hdr->ramdisk_size,
+ &boot_params->ext_ramdisk_size);
+ }
}

/*