From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 082E8606A31A for ; Tue, 27 Oct 2026 09:48:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=RTdU/Nfs; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=M5HfFoAj DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:To:References:Message-Id: Content-Transfer-Encoding:Cc:Date:In-Reply-To:From:Subject:Mime-Version: Content-Type:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=w+/m5TRiUEroTYi/JhU/ZMYvRJ27fL3IgAeL8IYLhOs=; b=RTdU/Nfse9qyOB mdv+xWq9nPGngp1k+IiJ3wnU8elrnbzgvD8wcz4+mDkpDgARVRDl1fKzgrFR/K1u2Lp/FhSFzWfKU FqUa8eV7VKqRSNjwL56KblylIHijGoaR1HVWhENl4kVhh0OwQI3teOr8ToTn9fBVZdTqQFqTLxgqX VZhFxXVJFDWT8gN5m1HC/ljAbjB+EegqVf+QQ8gWhr9/ptIoa1ZVZKVvon71LVCV5w7bArgIW7Fsj 9BylwKKp0fur2RXqtyQ4uW6h4IfMte6u6Y6jGQH/KB5gU0bgcVdnj3FOdbRzVSQPvCTLpLCaJT6cd HcbmeQSB8iUQQA7zALyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xLdnb-00000004DKA-2pd8; Tue, 27 Oct 2026 09:48:55 +0000 Received: from out-135.mta1.migadu.com ([95.215.58.135] helo=mta1.migadu.com) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xLdnX-00000004DJM-1Lt1 for kexec@lists.infradead.org; Tue, 27 Oct 2026 09:48:54 +0000 X-Envelope-To: kexec@lists.infradead.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: kexec@lists.infradead.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-Archived-By: 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261027_024851_903505_663E5835 X-CRM114-Status: GOOD ( 14.01 ) X-Spam-Score: -2.8 (--) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 > 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