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=1796221011; b=FhArES9CGF2fWY2O6Z8du46FfsPGb18DDq+SQ2OI1P2Mb5knNmBlH5i3wzvBb8zL3Flb UyIJd2V+rxfSRo9t2UV9RzqY421lwW/prqThxVIZ5KZtoUouISwwIwFq5Mq04dSUpWp16 +sa/IFxF3L0LiAR3Lj8cHMbPNhzE7REmqGmIrkMKQcgiAzv8k4dzjEirpH98RZoZXCA1S fh6rzN7FrTZH4kdvAbOoJERPgHQVnQg+xGlwnnAgp27+bGdbm1sgK1j4M0ZHyFblo8nNp OLE5+sLSiiezGCz3Jbb3cySheX2778+i3WCuHKuoqw41g0ZRcAO33/H65+kPSZIwGFw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221011; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=RdUUMnXEWhrcRrJTmKt72fX3vfN08OOr0x2JZwioWYU=; b=XnvgsesSTnFzcKmt7xrGLtmlUZgDKfwR3UFXfJgaXNjk3AGGNGc2D6mXLkEOc4WYKK8Z x4eIWEZB69SZmVJuVbWBUBiZeo/Mj8RC0uAQQHJlEUXDJsEzKC8h8o/EuUxtS0hKFa6sF t40r24zPGBNDmY7q0p0wAy7CGbn7TXWW/ubT37Bfs6qqKjxWopW00CzKsB92SkBbcUpaI 4UF0T5qwOinwWRLvUUD+Z6bVRcF78YMPTooOLgKLHL4OdaNSvenPS3Dq6i8ZuzK5u6Gl+ CFRpWoGvxAqde9RyeFusqlJuutJ+9Rzdy1QeHV0ZTUfsCtM7I98sjmk9ZWSweggRiGw== 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=1xc5nmNR; 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 51C62606A32D for ; Wed, 2 Dec 2026 14:16:51 +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=1xc5nmNR Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C9761F0089A; Wed, 2 Dec 2026 14:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221011; bh=RdUUMnXEWhrcRrJTmKt72fX3vfN08OOr0x2JZwioWYU=; h=Subject:To:Cc:From:Date; b=1xc5nmNRGdN9vISRH2ll60zEQYX1IxT9elEkZ9mbJ5VPfyKM5HQyAun38qmThCy6z PKz6EmmWUHV8EapBrnW7T0rA7vLvdPb1DSRHYOG9160m5HycDuObfVki0Nlw3LAlYU 2+yz34R0cqdteJUJBObpdzJrThsiuebDnpRrI20A= Subject: FAILED: patch "[PATCH] dma-pool: release CMA pages on atomic_pool_expand() error" failed to apply to 6.1-stable tree To: m.szyprowski@samsung.com Cc: From: Date: Wed, 02 Dec 2026 14:00:06 +0100 Message-ID: <2026120206-preacher-willow-783b@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.1-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.1.y git checkout FETCH_HEAD git cherry-pick -x ca010d38da7bf05a4572a54c2c16d6d64a758c3a # git commit -s git send-email --to '' --in-reply-to '2026120206-preacher-willow-783b@gregkh' --subject-prefix 'PATCH 6.1.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;