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=1796221000; b=sw5kylhUzGAy8qTN54BeBqUL0oYTV7NUtpHbIN9UijiMlkJhF3aCi1aBhImN9RzTd72V RN26mNoFMW2FgwKyhMWvWEclo6MyEC7F9agqc5cVszv40zUnptgV+MZNVGpE1V0jehbxO EvKWDXGJoe26A6BjUiha1MJ6i4M7kfGbjPDX5HWX559sQQ0KwTFoCHz/ykXKXwjChPFth zuH/s119ZFWIzrsb8FiwE1ufQLjS7G+xENfwFxtqR4JjFNx9lJo+AulMSJ8FSdVA6X9In GDNXjwihsBkN8DL5bdKkY4IbaV/0xOIk5cpWTJlPNke/aewJ5UE/iXMg9oouSVvXASg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221000; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=c+73vSPWUhsqSnmY2Wck6ytIljSGTsuW8zFj2f7G3mk=; b=q6pB3oP/71pVGqHP8N6NbPSrq1iPYRPk7QIIMD4FeoKQ5w4LCA3+ycvgMLNtpXE0tost MbA2bMxjfBpBIYPMDWcO49AixhxSLhk1Ax8O1aX6e+w1xNV7SMfjeI8bn5j2Ex8D1GUIu byNfDfvIup/XUYZf5mDSCT+FW4U1GP57FLTrKQNwg4dOw7bCkZG/lG84ro9XBXSDlwlw0 7LlL72Kmmkv9VGo0A4ZV7VxS2Si9bOkL3Wi81vlJMw12ztqQ8+stlQ507U6ntWOsfTiMP C/TghKWW/vsdFhkmlkAOV4qHw5xnPljy0VMjqskcOb3kP5uajElr9sqSyGSQBRwKnyA== 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=ROnbL6ik; 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 99BD8606A330 for ; Wed, 2 Dec 2026 14:16:40 +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=ROnbL6ik Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75EE71F00919; Wed, 2 Dec 2026 14:16:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221000; bh=c+73vSPWUhsqSnmY2Wck6ytIljSGTsuW8zFj2f7G3mk=; h=Subject:To:Cc:From:Date; b=ROnbL6ikZC4AsQ+eCUNRbjnmKYJ8ipNwPBCfY9jRanGneCAVvaCdYadsij1JVQBhO pHmmCfwnK8JS/9CREMfIkjTPHtI2zIU0qguAeiuqgyN5Eg5XeU2Y6zYM6K3vu4fMEN wv3Fky1AbkoFmAEiFecMgnFdLjLruo40k9EOAKX8= Subject: FAILED: patch "[PATCH] dma-pool: release CMA pages on atomic_pool_expand() error" failed to apply to 6.18-stable tree To: m.szyprowski@samsung.com Cc: From: Date: Wed, 02 Dec 2026 14:00:04 +0100 Message-ID: <2026120204-submerge-amount-299c@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.18-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.18.y git checkout FETCH_HEAD git cherry-pick -x ca010d38da7bf05a4572a54c2c16d6d64a758c3a # git commit -s git send-email --to '' --in-reply-to '2026120204-submerge-amount-299c@gregkh' --subject-prefix 'PATCH 6.18.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;