From nobody Sat Apr 18 09:24:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78179C43334 for ; Fri, 15 Jul 2022 09:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232970AbiGOJZL (ORCPT ); Fri, 15 Jul 2022 05:25:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232520AbiGOJZE (ORCPT ); Fri, 15 Jul 2022 05:25:04 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87E227A519 for ; Fri, 15 Jul 2022 02:25:01 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Lkm8t1mzJzjWyB; Fri, 15 Jul 2022 17:22:22 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500016.china.huawei.com (7.221.188.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 15 Jul 2022 17:24:59 +0800 From: Zhou Guanghui To: CC: , , Subject: [PATCH] mm/huge_memory: Return from zap_huge_pmd after WARN_ONCE. Date: Fri, 15 Jul 2022 09:22:38 +0000 Message-ID: <20220715092238.22663-1-zhouguanghui1@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500016.china.huawei.com (7.221.188.220) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" After WARN_ONCE is processed, the subsequent page judgment results in NULL pointer access. It is more reasonable to return from the function here. Signed-off-by: Zhou Guanghui --- mm/huge_memory.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 834f288b3769..7f5ccca6792a 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1601,8 +1601,11 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_a= rea_struct *vma, entry =3D pmd_to_swp_entry(orig_pmd); page =3D pfn_swap_entry_to_page(entry); flush_needed =3D 0; - } else + } else { + spin_unlock(ptl); WARN_ONCE(1, "Non present huge pmd without pmd migration enabled!"); + return 1; + } =20 if (PageAnon(page)) { zap_deposited_table(tlb->mm, pmd); --=20 2.17.1