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=1796221007; b=pp7nGLf3kr9Yxr9N6cy2+6pmghtiKv0Pp4Gy5HvqW461hWB5GOO/rWfAPxnrAz96zY6Y agjGzNIoc05GNZolLCM+Ef32eRxb6vXnu4ieWcxiR3cSXuLIkZDI4rG55KHk9lMcfn6BQ 1bvnYmxS0IgvD1qV/kC1xr0GNB5o0kHKk2rAJDQvVesRfqqax3Rg9MioqOEjEQNP7JfpS Vv/RFUkICsY5KTBMsJuI/4EmcxqI0PDGGrEwP900xoA+ckdU+me0seF5dk9C8mbGRC1aD 539VLeQQVSftCf3+Ydz6vWkg8+kdyOJ0RoqSpOMnfAKywqlP85eSKWLxdLAxBxkjEuA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221007; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=Et4eIkH+NX5GQ7yZCca7p93C5PQNMCQV5JzpUTkRFmA=; b=GN0Nooyd/ykVEmOYQDeUMuTwxDXM0eMypkSSEfx8HX+79FyAOYsZPfOC6MpiTV/ZIM5J q0iYPLJjKT9dHvXGV5WDDaGilIH65epAeH/UzAqbCyLkV2BF+56GGn7EOh4xsPpwelwjy VBn+FH4vWJTs0D5ze1OKEd3lj5QYa6K0f78H4zBoUM76Zxzeu1NIvhmB+cahn1h9Vcy9H RnmsU3Pw1ZvlVGj2SSO32vu/tILb3WpZl3XsAZFFneV4QIFNgsvHz53O4LZP9mqDBrJUb GMyJfzlPwjyr9y2NH9+z25Gw4w9wB7C+bh+Om7VddGz6pfpM1wsuBQCV4Mao9p0AROw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=JmuxIAAk; 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 B0439606A33B for ; Wed, 2 Dec 2026 14:16:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=JmuxIAAk Received: by smtp.kernel.org (Postfix) with ESMTPSA id B707F1F00923; Wed, 2 Dec 2026 14:16:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221007; bh=Et4eIkH+NX5GQ7yZCca7p93C5PQNMCQV5JzpUTkRFmA=; h=Subject:To:Cc:From:Date; b=JmuxIAAkMYhO9kNNSn55OpGXaknXDksnHkBXbkGp4fUKyh2/M1ur0Kv6w5QWe1LqQ Ew7NRd1sOrv0qrVYamkPqAYwI4EcoUNAzYAGM1e8HkZEwh08lHYbTwLfQE0Z/Y4vb/ y9L5l1qXKvQ4YfoDy1hu7Z5snd+7wKR96MRHgzBg= Subject: FAILED: patch "[PATCH] dma-pool: release CMA pages on atomic_pool_expand() error" failed to apply to 6.12-stable tree To: m.szyprowski@samsung.com Cc: From: Date: Wed, 02 Dec 2026 14:00:05 +0100 Message-ID: <2026120205-villain-friend-b1d2@gregkh> X-Mailing-List: stable@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=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y git checkout FETCH_HEAD git cherry-pick -x ca010d38da7bf05a4572a54c2c16d6d64a758c3a # git commit -s git send-email --to '' --in-reply-to '2026120205-villain-friend-b1d2@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From ca010d38da7bf05a4572a54c2c16d6d64a758c3a Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Mon, 26 Oct 2026 10:54:15 +0100 Subject: [PATCH] dma-pool: release CMA pages on atomic_pool_expand() error path atomic_pool_expand() may allocate the pool backing pages from CMA via dma_alloc_from_contiguous(), but the error path unconditionally frees them with __free_pages(). This hands CMA pages to the buddy allocator while leaving them marked as allocated in the CMA bitmap, permanently leaking CMA capacity on every failed expansion. Try dma_release_from_contiguous() first and fall back to __free_pages() only for pages that did not come from CMA, as the code did before CMA allocation was temporarily removed from the pool. Fixes: d7e673ec2c8e ("dma-pool: Only allocate from CMA when in same memory zone") Closes: https://sashiko.dev/#/bug/linux-fdfc6e83-15e4-4980-9818-691b034397e7 Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20261026095423.966856-5-m.szyprowski@samsung.com Signed-off-by: Marek Szyprowski diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c index 00f422a1e896..381b3cb28368 100644 --- a/kernel/dma/pool.c +++ b/kernel/dma/pool.c @@ -152,7 +152,8 @@ static int atomic_pool_expand(struct dma_gen_pool *dma_pool, size_t pool_size, dma_common_free_remap(addr, pool_size); free_page: #endif - if (!leak_pages) + if (!leak_pages && + !dma_release_from_contiguous(NULL, page, 1 << order)) __free_pages(page, order); out: return ret;