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:   Mon, 4 Mar 2019 10:29:59 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Aditya Pakki <pakki001@....edu>
Cc:     kjlu@....edu, Darren Hart <dvhart@...radead.org>,
        Andy Shevchenko <andy@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        Nicolai Stange <nstange@...e.de>,
        Kees Cook <keescook@...omium.org>,
        Andrew Banman <abanman@....com>,
        Mike Travis <mike.travis@....com>,
        Colin Ian King <colin.king@...onical.com>,
        Varsha Rao <rvarsha016@...il.com>,
        platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: uv: Fix potential NULL pointer dereference of
 kmalloc_node

On Sat, Mar 02, 2019 at 03:09:04PM -0600, Aditya Pakki wrote:
> kmalloc_node might fail to allocate memory for thp field. This fix
> attempts to avoid a potential NULL pointer dereference.
> 
> Signed-off-by: Aditya Pakki <pakki001@....edu>
> ---
>  arch/x86/platform/uv/tlb_uv.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
> index a4130b84d1ff..5a6d51e30a36 100644
> --- a/arch/x86/platform/uv/tlb_uv.c
> +++ b/arch/x86/platform/uv/tlb_uv.c
> @@ -2011,6 +2011,9 @@ static void make_per_cpu_thp(struct bau_control *smaster)
>  	size_t hpsz = sizeof(struct hub_and_pnode) * num_possible_cpus();
>  
>  	smaster->thp = kmalloc_node(hpsz, GFP_KERNEL, smaster->osnode);
> +	if (!smaster->thp)
> +		return;

This is init code; memeory allocation is 'unlikely' to fail. If it were
to fail, we'd have gotten a nice crash pinpointing the failure.

Now, we boot but get weird crashes later. Note how the rest of the code
assumes smaster->thp to be set. How is that any better?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ