All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Hongfu Li <hongfu.li@linux.dev>
Cc: david@kernel.org, osalvador@suse.de, akpm@linux-foundation.org,
	linux-mm@kvack.org, linux-cxl@vger.kernel.org,
	linux-kernel@vger.kernel.org, Hongfu Li <lihongfu@kylinos.cn>
Subject: Re: [PATCH] mm: add missing alloc_percpu() NULL check in hotplug init
Date: Fri, 17 Jul 2026 09:46:39 +0300	[thread overview]
Message-ID: <alnPz-r76FU6t5Uc@kernel.org> (raw)
In-Reply-To: <20260717052938.58447-1-hongfu.li@linux.dev>

On Fri, Jul 17, 2026 at 01:29:38PM +0800, Hongfu Li wrote:
> From: Hongfu Li <lihongfu@kylinos.cn>
> 
> No NULL check is done for alloc_percpu() when initializing per-CPU
> nodestats. Allocation failure leads to NULL pointer dereference
> during later memset.
> 
> Make function return int, check alloc_percpu() result and return
> -ENOMEM on error. The caller chain already propagates this error
> correctly.

I already applied a fix from Gregory:

https://patch.msgid.link/20260701221613.2818148-1-gourry@gourry.net

It'll be unstreamed soon.
 
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
> ---
>  include/linux/memory_hotplug.h |  2 +-
>  mm/memory_hotplug.c            |  3 ++-
>  mm/mm_init.c                   | 14 +++++++++++---
>  3 files changed, 14 insertions(+), 5 deletions(-)

-- 
Sincerely yours,
Mike.


  reply	other threads:[~2026-07-17  6:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17  5:29 [PATCH] mm: add missing alloc_percpu() NULL check in hotplug init Hongfu Li
2026-07-17  6:46 ` Mike Rapoport [this message]
2026-07-17  7:06   ` Hongfu Li

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=alnPz-r76FU6t5Uc@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=hongfu.li@linux.dev \
    --cc=lihongfu@kylinos.cn \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.