From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.174 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796326418; b=uhEO66T4/l/KUtOLjtdDCIV/cjnykPd1T8pUinnsFMmAKkawd6fsGV1AbKxto4gA/TmJ zarJOU8h24mwZ9SLvVcyZzgj3RnA79HqQ6NZOqw1mR32cHkr4/RigtEA1PnfAqyD0s/8K do+Fbt2KB8JpKugqyoPaWtsXLJEo8AXAtPJwXXOX8cUowguECjZDG1Q3fGsoAioCVcSxN JSC2rshvjuCG/FudfX7//Uc2ntnaz2DOLUnbDG4w1LTjDK9mxFsMPpNWHQJzZmxth/xUT 2+CVw0RktRMu3wfy9QWOlAgHAfxokdVT9wfDJjDgHONPr1uqSPC3ulKdSGSIgzyrpPQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796326418; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=FppSNc8yBGyb7aGO+J+Xtmrgf1nqSQBU5UkSf7pEwOw=; b=qT0SsvhuvhYCVUtrlg3KDANe4/WpI6vykMxuDUiUXPf6NeSjtRx9UmH5GfIY1p+nCNci GS1mAvvf+ycBItkOQ12iYn8ghR76tpMvx5WCa58HnBxbx07ERsy6Jy2w7Y4RKkLppzYmU kVSpPazaMrWiipmvUsc701qpcXEzeWxfqu9knGc4UyXv9/GuhPqaH1W0ktcS4YMeprSEW ni0OvesJtszUl/rQy2DjvgPhQ56oQ8RgA4cdnvg5W/TjKxWv5A3HLU8doOMJZFzmBjGfJ wv5oQG32U/S+CzVqR6lGgRX9M4/zhGzyGJwuGXQofX+QuuvHiK6iAk6qWllZqKieUGQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=bscW6ATq; arc=none smtp.remote-ip=209.85.128.174 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86286606A322 for ; Thu, 3 Dec 2026 19:33:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 86286606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=bscW6ATq Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-8b4d07494b0so15063457b3.0 for ; Thu, 03 Dec 2026 11:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796326398; x=1796931198; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=FppSNc8yBGyb7aGO+J+Xtmrgf1nqSQBU5UkSf7pEwOw=; b=bscW6ATqVNIo7SyLsJNqCGaa24P4Vbc+LlC5fhXxO1XLNhkK5F4ymdp9b/byuIuYzT Ru+PdPTG2z0d0V6nrRF9hqBQq06P9EOjnLaTvWY2CmMZzuPR7EDRXvWO63NfhHlrDEof NQy9b5NmrTRkVMBeQwcz8qaWk0Id4PGuld6elDOl5mH04PNEsBEZzkwwuC9PvZOrcb52 dzg5RwgAt/ypT9ZZ/Q6Xe4b4Tc9fjAxDO+K6LX6T4GxttpebnvW2QeJJS29G5FeqeQVU RJv1gb7WHtIXTmbYA+TjZ18/AdzJZFN15vuRqPMWdIuSThsMtBpbPOgVF1qgDpQE0vz0 UJGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796326398; x=1796931198; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=FppSNc8yBGyb7aGO+J+Xtmrgf1nqSQBU5UkSf7pEwOw=; b=ZVqDL1Iguc62Fo4F7u4RmzcH78/n91do31MLVMjSWlJ2S9xVXb9RLei6mXbm0xEHF/ EWyBpoO0wno26eI9jBJgwzbR2U/v/0WJ5XcDnQQJaDMU0DSqOC0xjQafEIBMJ4uhy6Kp MaPgM7ZPSHNsBEYZeLehxGH2lGpkvJy8bm/BaAmD5eO1ia89KtJKfxVIWIO6X9e86bBq QwSVKXUx54u0NYM0BhyXYDVnU7Ps9tNMRDPCUq0eCtto+18d1qcJrQIx0EPixmLfsD5g 88k7dRfiyE4remq0KqOTe3xH4Vq9mpUh5B+pfPLdAW/wXf5aONv7Cp+txp51/6tGP9D0 Epzw== X-Forwarded-Encrypted: i=1; AL+hErFGpqsQsnxEMXQVzF9Y4MWuk6kmkHM65IKGpG7vkwEDAfBlf3UgAV6jF6Gd2PF7nliWhdiJNlw4HPCV9ZM=@vger.kernel.org X-Gm-Message-State: APuU4Z/4ER6OikH5U6xb9NEe167WPkrLzzgQZWXbBBzsOY/9O/57nHSZ T/fdiibcj1SX6AKhFKPgvrouP3wjXu1NREPEiuD34nhdjiwSgBSrDuNS X-Gm-Gg: AZFdTZc18NyEr3xAMaSoch56wpPnujIVLjhd1YczBzMRJtt7HoosBQh7vO/ONzjDSdf epO4jJDlSDtbYSOzXX7a16rKKYq6RSH+jKaOxdvyIq89ZQXRND9MmJtE8Rf6e4wdgoOh8G9CHUi fI6zCT2M6EpVz/tc9mc3ICo+u1zc85k3It9zXY/Z4na4nxNxD3utQt2kZHVMbLFonjna/NhMn3e RwY5GPd8tiXiBkREy65t+aTvumboOR5rh0ujTp0m1IRs6MhI7VlbHl+y6N3fBzIzEQoOKuqcDgv XGOqk2pkdXt+wEpXCowG54r7XpJEtuJi88TDTbsgunm4g6EDsvJRqcoWsizmAmDme8KCmIyzLuG 5zYWuaGmXTUWQRilQRVaBBwK5yCCEPEjhcladfAf8VUdfF0tESNmNi+wGTZGpHGaAdbibIS8yn9 1x20KH0bZmX1gxuCOlVqdvfiBQPegWXkwPo8Zkc3Mk9cgcRd36UgSs4khCFKYdcnZreL6om8mr9 m18yLDtx7BpXswmvHxqYBBCCGttPV/Id6B/0eMwWb9MlCjb3uFN4Fq63g2MGEUtXdmlyXQNHWYT Ljb/vFW2JdAMbXdlt1EJsGfMq9W61dLWrLqxs8S4TY45USom68F8vJkUZQgaSimVyF/9PzvXeHx vqhdC X-Received: by 2002:a05:690c:9990:b0:8b5:9d75:1856 with SMTP id 00721157ae682-8b5f5d01993mr17242867b3.11.1796326397656; Thu, 03 Dec 2026 11:33:17 -0800 (PST) Received: from localhost ([2a03:2880:10ff:59::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b5202bc515sm181744537b3.19.2026.12.03.11.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 11:33:17 -0800 (PST) Date: Thu, 3 Dec 2026 11:33:16 -0800 From: Joshua Hahn To: Mike Rapoport Cc: Andrew Morton , David Hildenbrand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sashiko Subject: Re: [PATCH] mm/fake-numa: fix leak of the distance table copy on errors Message-ID: <20261203193206.3155944-1-joshua.hahnjy@gmail.com> References: <20261202164612.1573222-1-rppt@kernel.org> 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261202164612.1573222-1-rppt@kernel.org> On Wed, Dec 02, 2026 at 06:46:11PM +0200, Mike Rapoport wrote: > 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. Hello Mike, thank you for the fix! Looks good to me, Reviewed-by: Joshua Hahn Have a great day! Joshua > 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 > >