From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796229977; b=WhgJaTwBqSX2l73ScCSOb2rq9c5SoKH2RjYgrQiVNzAK9RRLpXQoR2LxPj6Vo7hSp+Je 9PrBKizedgO/2H5HXq/GlryQCsavTWCN+7ImjVLP0HPQwTh1k5sdfq3rNRRC0d7vyvfyb Lslpnn3HHa+5Ij3qUgznU2ZBbuUb+Tcu4JOYKaNuMzeet1jwwjJa4YXCPFneWqTQVBVpx jW6RIjxA8peSYGRiAsEFf1kzRbToeJ9/J1GqXUpjYHvqey+IWMwUfTQ+vZhjuNCsKdDyy TDpluZZUXRGk2FasZUP/OH7Sr/krlENaJ0sHw8a2/ixYEw9VgbDDhHHCJ/e6e5Oi53g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796229977; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=YAVmu6ggyaeCz7UFaAwbdbxu4K36OnKYCZ5HPKCwav8=; b=etJz4k2pXikp1LualkrkIzmughwPK6brUORuL32tQaCpSiDA/PK4HuGxQi7z5AkItgC/ mCxAZZYpy6VcCltTSVzSmyiMDwuJ54MMBUbSOhUafJ3rU0B3KOFzK0h9S71yMRb1lX5HN 82tthJ+cLVGewIOhoZ6Etwvng9kqPw7Dnu3ffHWC8r533ho4VcDy5eYuYr7DUZkP1Qvqr wxeH8iZXzI2j1NImw248Z520/GQileQ0PNoIUPYIKqpmNREAaVWCwWohUG2ADfo6gqgXY MaMaUFYa/KuKZ74d9Z5EMwBR4vK8B1eV1kW0IkKfPXHVuxIURrlyFtXi7sbWtO6Oz1g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LgOEW4YO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49E0F606A322 for ; Wed, 2 Dec 2026 16:46:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LgOEW4YO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BE691F000C1; Wed, 2 Dec 2026 16:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796229977; bh=YAVmu6ggyaeCz7UFaAwbdbxu4K36OnKYCZ5HPKCwav8=; h=From:To:Cc:Subject:Date; b=LgOEW4YO6tz0nN+UJomMasLgc4So5pLf6o6WjvWOEn0RQd4t8An8So+A9naK0YSFA vBXw0T/OoSDvd/me9jZj/MOk4nwTaxwbfPf1rdueK5gQn/2ohMz+wVMpUNo0VlSCXZ 34+z+SJ4jfl7IJw5xQUOmtI1JQ+M1mD3puhBBpeJ1AZ2IJUUkUu3D8hx72OBVJKMzs OY8/QRMvqW/T1QxFyUIBFmTlmvKoGCTOIt7VAfhgJpklt0Fc/BwtZKhGWquVjbXEIl GlMpgRzqNrFiSDwI9gEsbAfwK/moTS30GNbYXAiB7dhzEZvMDF5A2X0JRxSfFk26pN MbkGFeefnGUoA== From: Mike Rapoport To: Mike Rapoport Cc: Andrew Morton , David Hildenbrand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sashiko Subject: [PATCH] mm/fake-numa: fix leak of the distance table copy on errors Date: Wed, 2 Dec 2026 18:46:11 +0200 Message-ID: <20261202164612.1573222-1-rppt@kernel.org> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Mike Rapoport (Microsoft)" 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. Reported-by: Sashiko Closes: https://sashiko.dev/bug/linux-96a473a0-2815-4091-910e-970513fa6467 Fixes: 63db8170bf34 ("mm/fake-numa: allow later numa node hotplug") --- mm/numa_emulation.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/numa_emulation.c b/mm/numa_emulation.c index 55f26b22bb0be..d79b5e42b5415 100644 --- a/mm/numa_emulation.c +++ b/mm/numa_emulation.c @@ -546,6 +546,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) 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++) base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244 -- 2.53.0