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]
Date:   Fri, 11 Nov 2022 16:03:51 +0100
From:   Thomas Bogendoerfer <tsbogend@...ha.franken.de>
To:     Liao Chang <liaochang1@...wei.com>
Cc:     chenhuacai@...nel.org, jiaxun.yang@...goat.com,
        tangyouling@...ngson.cn, hejinyang@...ngson.cn,
        linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] MIPS: Loongson64: Add WARN_ON on kexec related kmalloc
 failed

On Thu, Nov 03, 2022 at 09:18:15AM +0800, Liao Chang wrote:
> Add WARN_ON on kexec related kmalloc failed, avoid to pass NULL pointer
> to following memcpy and loongson_kexec_prepare.
> 
> Fixes: 6ce48897ce47 ("MIPS: Loongson64: Add kexec/kdump support")
> Signed-off-by: Liao Chang <liaochang1@...wei.com>
> ---
>  arch/mips/loongson64/reset.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/arch/mips/loongson64/reset.c b/arch/mips/loongson64/reset.c
> index 758d5d26aaaa..e420800043b0 100644
> --- a/arch/mips/loongson64/reset.c
> +++ b/arch/mips/loongson64/reset.c
> @@ -16,6 +16,7 @@
>  #include <asm/bootinfo.h>
>  #include <asm/idle.h>
>  #include <asm/reboot.h>
> +#include <asm/bug.h>
>  
>  #include <loongson.h>
>  #include <boot_param.h>
> @@ -159,8 +160,17 @@ static int __init mips_reboot_setup(void)
>  
>  #ifdef CONFIG_KEXEC
>  	kexec_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL);
> +	if (WARN_ON(!kexec_argv))
> +		return -ENOMEM;
> +
>  	kdump_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL);
> +	if (WARN_ON(!kdump_argv))
> +		return -ENOMEM;
> +
>  	kexec_envp = kmalloc(KEXEC_ENVP_SIZE, GFP_KERNEL);
> +	if (WARN_ON(!kexec_envp))
> +		return -ENOMEM;
> +
>  	fw_arg1 = KEXEC_ARGV_ADDR;
>  	memcpy(kexec_envp, (void *)fw_arg2, KEXEC_ENVP_SIZE);
>  
> -- 
> 2.17.1

applied to mips-fixes.

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