[PATCH] efi_loader: loosen buffer parameter check in efi_file_read_int

Peter Robinson pbrobinson at gmail.com
Wed Apr 28 14:22:26 CEST 2021


On Wed, Apr 28, 2021 at 8:43 AM Peng Fan (OSS) <peng.fan at oss.nxp.com> wrote:
>
> From: Peng Fan <peng.fan at nxp.com>
>
> This is same issue as https://bugzilla.redhat.com/show_bug.cgi?id=1733817,
> but that fix was wrongly partial reverted.
>
> To Fedora shim loader, when buffer is NULL, a use-case is to call
> efi_file_read with *buffer_size=0 and buffer=NULL to obtain the needed
> size before doing the actual read.
>
> Otherwise, we always met "Could not read \EFI\: Invalid Parameter"
>
> Fixes: db12f518edb0("efi_loader: implement non-blocking file services")
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Cc: Stefan Sørensen <stefan.sorensen at spectralink.com>

Tested-by: Peter Robinson <pbrobinson at gmail.com>

Tested on a patched 2021.04 with Fedora 34. Thanks!

> ---
>  lib/efi_loader/efi_file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
> index 204105e25a..6b3f5962be 100644
> --- a/lib/efi_loader/efi_file.c
> +++ b/lib/efi_loader/efi_file.c
> @@ -554,7 +554,7 @@ static efi_status_t efi_file_read_int(struct efi_file_handle *this,
>         efi_status_t ret = EFI_SUCCESS;
>         u64 bs;
>
> -       if (!this || !buffer_size || !buffer)
> +       if (!this || !buffer_size)
>                 return EFI_INVALID_PARAMETER;
>
>         bs = *buffer_size;
> --
> 2.30.0
>


More information about the U-Boot mailing list