lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220214084124.GA11866@sunil-ThinkPad-T490>
Date:   Mon, 14 Feb 2022 14:11:24 +0530
From:   Sunil V L <sunilvl@...tanamicro.com>
To:     Ard Biesheuvel <ardb@...nel.org>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Atish Patra <atishp@...shpatra.org>
Cc:     linux-efi@...r.kernel.org, linux-riscv@...ts.infradead.org,
        linux-kernel@...r.kernel.org,
        Heinrich Schuchardt <xypron.glpk@....de>,
        Anup Patel <apatel@...tanamicro.com>, stable@...r.kernel.org
Subject: Re: [PATCH] riscv/efi_stub: Fix get_boot_hartid_from_fdt() return
 value

Hi Ard,
   Could you please take this patch? Heinrich and Atish have added RB
   tag. Let me know if I need to do anything.
Thanks
Sunil

On Fri, Jan 28, 2022 at 10:20:04AM +0530, Sunil V L wrote:
> The get_boot_hartid_from_fdt() function currently returns U32_MAX
> for failure case which is not correct because U32_MAX is a valid
> hartid value. This patch fixes the issue by returning error code.
> 
> Fixes: d7071743db31 ("RISC-V: Add EFI stub support.")
> Cc: stable@...r.kernel.org
> 
> Signed-off-by: Sunil V L <sunilvl@...tanamicro.com>
> ---
>  drivers/firmware/efi/libstub/riscv-stub.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/firmware/efi/libstub/riscv-stub.c b/drivers/firmware/efi/libstub/riscv-stub.c
> index 380e4e251399..9c460843442f 100644
> --- a/drivers/firmware/efi/libstub/riscv-stub.c
> +++ b/drivers/firmware/efi/libstub/riscv-stub.c
> @@ -25,7 +25,7 @@ typedef void __noreturn (*jump_kernel_func)(unsigned int, unsigned long);
>  
>  static u32 hartid;
>  
> -static u32 get_boot_hartid_from_fdt(void)
> +static int get_boot_hartid_from_fdt(void)
>  {
>  	const void *fdt;
>  	int chosen_node, len;
> @@ -33,23 +33,26 @@ static u32 get_boot_hartid_from_fdt(void)
>  
>  	fdt = get_efi_config_table(DEVICE_TREE_GUID);
>  	if (!fdt)
> -		return U32_MAX;
> +		return -EINVAL;
>  
>  	chosen_node = fdt_path_offset(fdt, "/chosen");
>  	if (chosen_node < 0)
> -		return U32_MAX;
> +		return -EINVAL;
>  
>  	prop = fdt_getprop((void *)fdt, chosen_node, "boot-hartid", &len);
>  	if (!prop || len != sizeof(u32))
> -		return U32_MAX;
> +		return -EINVAL;
>  
> -	return fdt32_to_cpu(*prop);
> +	hartid = fdt32_to_cpu(*prop);
> +	return 0;
>  }
>  
>  efi_status_t check_platform_features(void)
>  {
> -	hartid = get_boot_hartid_from_fdt();
> -	if (hartid == U32_MAX) {
> +	int ret;
> +
> +	ret = get_boot_hartid_from_fdt();
> +	if (ret) {
>  		efi_err("/chosen/boot-hartid missing or invalid!\n");
>  		return EFI_UNSUPPORTED;
>  	}
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ