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] [day] [month] [year] [list]
Message-ID: <20230412133234.GF11717@alpha.franken.de>
Date:   Wed, 12 Apr 2023 15:32:34 +0200
From:   Thomas Bogendoerfer <tsbogend@...ha.franken.de>
To:     Jiaxun Yang <jiaxun.yang@...goat.com>
Cc:     linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
        and@....com, stable@...r.kernel.org
Subject: Re: [PATCH] MIPS: fw: Allow firmware to pass a empty env

On Tue, Apr 11, 2023 at 12:14:26PM +0100, Jiaxun Yang wrote:
> fw_getenv will use env entry to determine style of env,
> however it is legal for firmware to just pass a empty list.
> 
> Check if first entry exist before running strchr to avoid
> null pointer dereference.
> 
> Cc: stable@...r.kernel.org
> Link: https://github.com/clbr/n64bootloader/issues/5
> Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
> ---
> Note: Fixes tag is intentionally omitted for this patch, although
> the booting issue only comes in 6.1, the logic issue is been since very start.
> ---
>  arch/mips/fw/lib/cmdline.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/fw/lib/cmdline.c b/arch/mips/fw/lib/cmdline.c
> index f24cbb4a39b5..892765b742bb 100644
> --- a/arch/mips/fw/lib/cmdline.c
> +++ b/arch/mips/fw/lib/cmdline.c
> @@ -53,7 +53,7 @@ char *fw_getenv(char *envname)
>  {
>  	char *result = NULL;
>  
> -	if (_fw_envp != NULL) {
> +	if (_fw_envp != NULL && fw_envp(0) != NULL) {
>  		/*
>  		 * Return a pointer to the given environment variable.
>  		 * YAMON uses "name", "value" pairs, while U-Boot uses
> -- 
> 2.39.2 (Apple Git-143)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ