From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB2CE5304AB; Wed, 30 Sep 2026 17:49:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790790578; cv=none; b=LtG/DmN/ov6x51E0n+EWnuPdL7WHg+xPa+i/bweV6SGTmCS2Yr4ih23SU72uoV4Hn1kf9e2UByLaB9LgTzn6PeQHwTlemk2kYnHDmxoIDVGYwfOD7Z5puoI3rCtS3SIthhLTs/cMPlbXMVPAUhAcVjBnwQxjd1W/ut55NeJqLuc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790790578; c=relaxed/simple; bh=rCP14FG4VAFxWoh67+7cHyf6xqN+EmOJKcUzeGmKawo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OsEP/LU0b4I9aD8SbFEj41ekFCinAP18TDPuaY/MYlSiDfKnTpAVw3NJAZpe5omQ+w1+xwFZPuPTym5cEeMHKcIT4BhvKpNwpHY4RckqgwOhd9hg4B73CgD2QN3n42ejk7xFS2rRC+DM9sG+Fsk03sAFJJOHMFa80wESHWKFtRA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yqJIG3RM; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yqJIG3RM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 586CF1F000FF; Wed, 30 Sep 2026 17:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790790576; bh=C32iwCTg934FqoWhS2hGhi2HHloal827BrDMC+nRC+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=yqJIG3RMXXKwDQDF2d5bRIGS3EZO2BYC0GAVBvJ8vels/zZRn782lnD8q4jZmKNDR eEZTPaD/ItmNn5ajsEqVGYZC+KUeCtQDlrtJgdY6WdVkemv90rvCnpEM5Xrjf3d2I8 PdIydrsVmbzFwBvBrAOLaYvnF4xoPwLTnVTuwQ4Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Longlong Xia , Andrew Morton , Muchun Song , David Hildenbrand , Miaohe Lin , Michal Hocko , Oscar Salvador , Sasha Levin Subject: [PATCH 6.12 833/877] mm/hugetlb: do not dissolve gigantic pages without runtime support Date: Wed, 30 Sep 2026 17:29:04 +0200 Message-ID: <20260930152432.710751483@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152414.738996857@linuxfoundation.org> References: <20260930152414.738996857@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Longlong Xia [ Upstream commit a363c62a653cc8b3e21da9545fa4e028ef50f9c3 ] dissolve_free_hugetlb_folio() doesn't check hstate_is_gigantic_no_runtime(h) though remove_hugetlb_folio()/ update_and_free_hugetlb_folio() silently bail for such folios, so it frees a still-listed folio and, on vmemmap restore failure, the add_hugetlb_folio() rollback corrupts the free list. Link: https://lore.kernel.org/20260823044118.1097121-2-xialonglong2025@163.com Fixes: 6eb4e88a6d27 ("hugetlb: create remove_hugetlb_page() to separate functionality") Signed-off-by: Longlong Xia Signed-off-by: Andrew Morton Assisted-by: Codex:gpt-5.6-sol Acked-by: Muchun Song Cc: David Hildenbrand Cc: Miaohe Lin Cc: Michal Hocko Cc: Oscar Salvador Cc: Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- mm/hugetlb.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2214,6 +2214,15 @@ retry: struct hstate *h = folio_hstate(folio); bool adjust_surplus = false; + /* + * remove_hugetlb_folio()/update_and_free_hugetlb_folio() bail + * for gigantic hstates without runtime support, so dissolving one + * here would leave it on the free list and, on vmemmap restore + * failure, the add_hugetlb_folio() rollback corrupts that list. + */ + if (hstate_is_gigantic_no_runtime(h)) + goto out; + if (!available_huge_pages(h)) goto out;