Re: [PATCH] mm: add missing alloc_percpu() NULL check in hotplug init

From: Hongfu Li

Date: Fri Jul 17 2026 - 03:09:52 EST



On 7/17/26 2:46 PM, Mike Rapoport wrote:
On Fri, Jul 17, 2026 at 01:29:38PM +0800, Hongfu Li wrote:
From: Hongfu Li <lihongfu@xxxxxxxxxx>

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@xxxxxxxxxx

It'll be unstreamed soon.

Got it, I'll drop this patch as Gregory's fix is already on the way upstream.