mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Nicolai Stange <nstange@suse.de>,
	Kees Cook <keescook@chromium.org>,
	Andrew Banman <abanman@hpe.com>,
	Mike Travis <mike.travis@hpe.com>,
	Colin Ian King <colin.king@canonical.com>,
	Varsha Rao <rvarsha016@gmail.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: uv: Fix potential NULL pointer dereference of kmalloc_node
Date: Sat, 2 Mar 2019 15:22:29 -0600	[thread overview]
Message-ID: <8c14879c-891d-db56-2dca-cd3b68afce2d@embeddedor.com> (raw)
In-Reply-To: <20190302210905.13032-1-pakki001@umn.edu>

Hi Aditya,

On 3/2/19 3:09 PM, Aditya Pakki wrote:
> kmalloc_node might fail to allocate memory for thp field. This fix
> attempts to avoid a potential NULL pointer dereference.
>

If this was detected by any static analyzer, please mention the
tool in the commit log.

Also, notice that this code does not apply to linux-next.

Thanks
--
Gustavo

> Signed-off-by: Aditya Pakki <pakki001@umn.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;
> +
>  	memset(smaster->thp, 0, hpsz);
>  	for_each_present_cpu(cpu) {
>  		smaster->thp[cpu].pnode = uv_cpu_hub_info(cpu)->pnode;
> 

  parent reply	other threads:[~2019-03-02 21:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-02 21:09 Aditya Pakki
2019-03-02 21:12 ` Joe Perches
2019-03-02 21:22 ` Gustavo A. R. Silva [this message]
2019-03-04  9:29 ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c14879c-891d-db56-2dca-cd3b68afce2d@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=abanman@hpe.com \
    --cc=andy@infradead.org \
    --cc=bp@alien8.de \
    --cc=colin.king@canonical.com \
    --cc=dvhart@infradead.org \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.travis@hpe.com \
    --cc=mingo@redhat.com \
    --cc=nstange@suse.de \
    --cc=pakki001@umn.edu \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rvarsha016@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome