All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,david@kernel.org,rppt@kernel.org,
	akpm@linux-foundation.org
Subject: + mm-fake-numa-fix-leak-of-the-distance-table-copy-on-errors.patch added to mm-unstable branch
Date: Wed, 02 Dec 2026 10:52:48 -0800	[thread overview]
Message-ID: <20261202185248.C69F71F000C1@smtp.kernel.org> (raw)
In-Reply-To: <20261202164612.1573222-1-rppt@kernel.org>


The patch titled
     Subject: mm/fake-numa: fix leak of the distance table copy on errors
has been added to the -mm mm-unstable branch.  Its filename is
     mm-fake-numa-fix-leak-of-the-distance-table-copy-on-errors.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-fake-numa-fix-leak-of-the-distance-table-copy-on-errors.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
Subject: mm/fake-numa: fix leak of the distance table copy on errors
Date: Wed, 02 Dec 2026 18:46:11 +0200

numa_emulation() copies the physical distance table before calling
fix_pxm_node_maps(), but if fix_pxm_node_maps() fails, the copy is never
freed.

This only happens with numa=fake= setups that fix_pxm_node_maps() already
warns about, and leaks a single page on systems with up to 64 nodes.

Free the copy at no_emu.  memblock_free() ignores NULL, so this is safe
for the errors that happen before the table is copied.

Link: https://patch.msgid.link/20261202164612.1573222-1-rppt@kernel.org
Fixes: 63db8170bf34 ("mm/fake-numa: allow later numa node hotplug")
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/bug/linux-96a473a0-2815-4091-910e-970513fa6467
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>

 mm/numa_emulation.c |    1 +
 1 file changed, 1 insertion(+)

--- a/mm/numa_emulation.c~mm-fake-numa-fix-leak-of-the-distance-table-copy-on-errors
+++ a/mm/numa_emulation.c
@@ -546,6 +546,7 @@ void __init numa_emulation(struct numa_m
 	return;
 
 no_emu:
+	memblock_free(phys_dist, phys_size);
 	numa_nodes_parsed = physnode_mask;
 	/* No emulation.  Build identity emu_nid_to_phys[] for numa_add_cpu() */
 	for (i = 0; i < ARRAY_SIZE(emu_nid_to_phys); i++)
_

Patches currently in -mm which might be from rppt@kernel.org are

mm-cma-simplify-cma_declare_contiguous_multi.patch
mm-fake-numa-fix-leak-of-the-distance-table-copy-on-errors.patch
hibernation-make-swsusp_page-helpers-static.patch
hibernation-ensure-secretmem-pages-dont-reach-a-snapshot.patch
hibernate-handle-potential-errors-in-hibernate_mapunmap_page.patch
hibernation-kfence-explicitly-map-unmap-kfence-pages.patch
hibernation-make-hibernation-unavailable-when-debug_pagealloc-is-on.patch


      parent reply	other threads:[~2026-12-02 18:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 16:46 [PATCH] mm/fake-numa: fix leak of the distance table copy on errors Mike Rapoport
2026-12-02 16:54 ` David Hildenbrand (Arm)
2026-12-02 18:52 ` Andrew Morton [this message]

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=20261202185248.C69F71F000C1@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=rppt@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 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.