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=1796221004; b=svNpM+dlBFts0kZUcmx7p/VslTF3JBr7aeW4cbGFhkzSh/WdQXVcTCRSAqQPcVZWxyVT Iw/FvbUv/OGfepxdVySOD7+GQbEvqmXVk7IbbiBHF0yopmiyjnV1aBUpWgx/fSuOCH6Cy n2gyO9KaGHCFQ/HRQNyZp17X8q/kvlflaVGNEb2LO5QIgSlxrtfuaoAqvdY+fkpY9Mguy ZEl1uIbLNwu7KlsbBOhhTN6zpBFcu3obhzk8DUqueagS+6XOel+3VEaEaHHFUWzjGmn/+ f6k2RnxUzy8GkPiL6drKyIbx5z6k2jBv66oKmWNiGAUwiAxpkZxUAqa49Aju/ODrIBw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221004; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=7nxQxke+pCPQeiRtvzFph1AwXsvCiFmYNIosc5/q8N0=; b=XXj7gHJsKbqSWx2g1AyQzyqc30JyN1h8K9fA/xoOplECem2sxTK+uSTXpNeAC4WIb2vH 6qcuy4VJ6VhlE96hgSa6p/cKd7bsRtHo71CVCw+Jxks2VnBIMM+0i3I9uZpkH0rrb6lQL /4B7dTM64u57AnsEakIMpDiov2Jojubw9Mwb5u14mMmxe++Qneio3IYAG7G13ycuLcPNC QsdPnOvoBemF6TTmYFZHrc3clNsx9L3U2h7TTqo2mbYemcBoTTM2QvvlbP9uC16FiQBIW irJk2loZ1uDaa9q0SgL0nX8Q7DlA/fCw4gJqZeNO0TSKxIJ9TI2sf05Hogxy41xiaIA== 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=0jv6Xs0N; 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 33645606A332 for ; Wed, 2 Dec 2026 14:16:44 +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=0jv6Xs0N Received: by smtp.kernel.org (Postfix) with ESMTPSA id 314421F0092B; Wed, 2 Dec 2026 14:16:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221003; bh=7nxQxke+pCPQeiRtvzFph1AwXsvCiFmYNIosc5/q8N0=; h=Subject:To:Cc:From:Date; b=0jv6Xs0N6hreQrUpib6LHreOICjDfJ6BKH2hQST74y2aLWu+nLPY9kob/1qWl+uTC v4LBBHeDkocVXTD3c0dlIRPUO7y2XHGH+TyAKw2Cia2r0IEA+TLEmkWboLqFVIU2wY 6q6U5g8+YStbChzIXF5n1T1XuJ3owhISleRtKdSw= Subject: FAILED: patch "[PATCH] dma-pool: release CMA pages on atomic_pool_expand() error" failed to apply to 6.6-stable tree To: m.szyprowski@samsung.com Cc: From: Date: Wed, 02 Dec 2026 14:00:05 +0100 Message-ID: <2026120205-grumbling-salaried-cc68@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.6-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.6.y git checkout FETCH_HEAD git cherry-pick -x ca010d38da7bf05a4572a54c2c16d6d64a758c3a # git commit -s git send-email --to '' --in-reply-to '2026120205-grumbling-salaried-cc68@gregkh' --subject-prefix 'PATCH 6.6.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;