From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793094531; b=MDYMniYKCKlMq45DsH6uFoHXipCcQ9LHoWyVuJx/Wr0hfiONjqOpIVrwOQsWwFIARZRS h+oST/1Qj+Aj8NcJcJIAPGnuqJzPlszWgAquRT8mVgmLkv0HasKc3ype4Uetz4tgw17ob sHKQzoshN+UWJQmyJkklJ6R693ygdiHuAXKjtT5hmnJyKOYXgAzcCbxnttyL2XZqN23w9 126Qg47SX/WkWGvd5BBURcNGyidoY61FftTz4zKSj5YCIgfEufy0JNFRUswhPFf1kdZRk dsyHZKUxy6Hl3PaaiN74qvORqFvmv28IY50FVD3/VdrEh3Cz1HG0x8FVaP8UmEJwCXA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793094531; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Content-Type:Mime-Version:Subject:From: In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References: To:X-Mailer; bh=w+/m5TRiUEroTYi/JhU/ZMYvRJ27fL3IgAeL8IYLhOs=; b=dpuCrf4LAQVcF49psI7LwMolBACM6Lr1zvccFBLaGCr1bPggZtR/rRhoyAR7Hmrt8RQO gyB1nuFOg1AfEMP6KfPhdOHhlMYXisnxfyF7N/6Urmc5DyD00S7P/RlIz3qqDperKxndq uJNGUZJn80CdTplS6rMGQSEWEEqptJ+wUv9uluMrZa+UkhachC9p7lJLCbEXwS4xc0pt2 oTpBw4ho1ZTO+LW0RXIkf1nMWbI0hCdzmkUS6gp/deMAdX5Ud1cO6QyK1Ntw5RpS5KewH 3Fi8F+ClumiCTrqe4iwyWwBZf6x4p5SRldG3/g8Kk5Pb8fxbYEl/3BXaXROug7c6I4g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=M5HfFoAj; arc=none smtp.remote-ip=95.215.58.131 Received: from mta1.migadu.com (out-131.mta1.migadu.com [95.215.58.131]) (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 26D9B606A31A for ; Tue, 27 Oct 2026 09:48:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 26D9B606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=M5HfFoAj X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=w+/m5TRiUEroTYi/JhU/ZMYvRJ27fL3IgAeL8IYLhOs=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1793094529; v=1; x=1793699329; b=M5HfFoAjUDnRgQrtlqwxlCzg/yUz3ct1gnJFOAIpEV4mZEEV3dK1BLmaugjdYXhR6Y1192oO bvxwaI9qa6LHkm0LAQTLWGbPluusZ6PGzBIq6PiGDoL/kcvoOndbK+wUxRwtkmmdvKO7NuAJ/E3 CZvZDj4wGfkHNKwOBZvMDrNc= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta11.migadu.com with ESMTPS id 74e52af488cb4c06; Tue, 27 Oct 2026 09:48:48 +0000 X-Mizu-Trace-ID: 74e52af488cb4c06 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset=us-ascii 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 (Mac OS X Mail 16.0 \(3901.100.1.1.12\)) Subject: Re: [PATCH 44/46] mm/cma: don't release CMA pages still in use From: Muchun Song In-Reply-To: <20261027-fixes_core-v1-44-6f74bec9a5bb@kernel.org> Date: Tue, 27 Oct 2026 17:48:18 +0800 Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Qi Zheng , Shakeel Butt , Lorenzo Stoakes , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Baolin Wang , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Kees Cook , Peter Zijlstra , Jann Horn , Pedro Falcato , Hugh Dickins , Pasha Tatashin , Pratyush Yadav , "Matthew Wilcox (Oracle)" , Jan Kara , Zi Yan , Lance Yang , Rik van Riel , Harry Yoo , Alistair Popple , Nico Pache , Ryan Roberts , Dev Jain , Usama Arif , Kiryl Shutsemau , Matthew Brost , John Hubbard , Peter Xu , Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Oscar Salvador , Minchan Kim , Xu Xin , Chengming Zhou , Chris Li , Kemeng Shi , Nhat Pham , Youngjun Park , Gregory Price , Joshua Hahn , Rakie Kim , Ying Huang , Jason Gunthorpe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-cxl@vger.kernel.org, stable@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20261027-fixes_core-v1-0-6f74bec9a5bb@kernel.org> <20261027-fixes_core-v1-44-6f74bec9a5bb@kernel.org> To: "David Hildenbrand (Arm)" X-Mailer: Apple Mail (2.3901.100.1.1.12) > On Oct 27, 2026, at 07:18, David Hildenbrand (Arm) = wrote: >=20 > From: Rik van Riel >=20 > When a driver calls dma_free_contiguous() before quiescing DMA, the > page might still have a reference from the device. > put_page_testzero() there returns false, WARN fires, but the code = proceeds > to free_contig_frozen_range() putting a live page onto buddy and = clearing > the bitmap. A subsequent allocation can hand the same PFN to a new > owner while the original holder still references it. >=20 > A concurrent put_page() that drops the last reference between the > testzero loop and free_contig_frozen_range() can double-queue the page > via page->lru, corrupting buddy lists. >=20 > Avoid the corruption by not freeing a CMA region if any of the > pages inside are still in use. >=20 > Make it explicit in the warning that the driver allowed a leak. >=20 > While at it, use page_ref_freeze() to make the semantics clearer and > switch to pr_warn_ratelimited(). >=20 > Fixes: 9bda131c6093 ("mm: cma: add cma_alloc_frozen{_compound}()") > Cc: stable@vger.kernel.org > Signed-off-by: Rik van Riel > Link: https://patch.msgid.link/20260811132045.5f114772@fangorn > [ david: use page_ref_freeze() + pr_warn_ratelimited() ] > Signed-off-by: David Hildenbrand (Arm) Acked-by: Muchun Song Thanks