Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1684607pxb; Wed, 9 Feb 2022 02:07:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8DgIdHnUs8fAUx8++1d6ZSU1sSRnYxg9wJdjIlByhA6dSqItXGGqKYISTS9Te1M0ER04D X-Received: by 2002:a63:6c84:: with SMTP id h126mr1276994pgc.456.1644401276618; Wed, 09 Feb 2022 02:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644401276; cv=none; d=google.com; s=arc-20160816; b=KgmvKGbt2y8Uu5gamQyN9ggBlCXxywRG8LHSwwhErfOOBvd0ncaedTlkA3/pQaTVJ4 ZD4y3mkbIZPAINNrDc2uG1jJTt6BmK8+fMe/VPHcU5cocxrBF7U5qHgih7kTV13JUS1O JIDeYyzOvWnF2rG38WrmzWeBTCUD7qk6VGoVR57PnUDRk/Wlo7za4bzZubd5nSzHACZo xLM4f2l+BsjWhwLiD+DOcEVQ+8PrAiScPloImrSsLx/QC8XhM/M2bh0dOvqzQ8RAlR39 jGxNuX4oADL0WRuZrKKfKKNZw3f9vEJvr32OFd3hjQ6cBGHSo1lK5T9QZ6WWra1guftW T0Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=GW9KgMRuZLYQ44Oes86Q/noBu+jdb8KLQwRMX85EyfQ=; b=HSEhea3iLFWUdhCDB3OG0ndLe6KhAFu+GiFSwv4lrQf9kDVaYLkjKV/c5zutS85tWj Fnrf7tbSu42tVWVB56aTeKqWVhkJ09uqlZrzOhTDs9QHvOri+KG/bw/lVsONPjH4Z53P vI0+yMGrBNQwW44s+tRk+jgRsTtUpZNIcJWdwI3/U4SQGPdin1VW16Eao6ybrxChPMoC bIZopCA+AGVyexrqEj3BEGNrLLS2D4tDujl7f3HGwNytJhAYwdYxcbMkNZAD/vmamTfA Q0G8JUhH4POs/SFKw6xPprTUz2KZAoRM7OviMRJ+QPO0KA8n45im+wkfpB5MQp0OK4Gi x4zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j71si15591908pge.309.2022.02.09.02.07.43; Wed, 09 Feb 2022 02:07:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239643AbiBGIHR (ORCPT + 99 others); Mon, 7 Feb 2022 03:07:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242269AbiBGIFj (ORCPT ); Mon, 7 Feb 2022 03:05:39 -0500 X-Greylist: delayed 680 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 07 Feb 2022 00:05:38 PST Received: from spam.unicloud.com (mx.gosinoic.com [220.194.70.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09AF6C043181; Mon, 7 Feb 2022 00:05:37 -0800 (PST) Received: from spam.unicloud.com (localhost [127.0.0.2] (may be forged)) by spam.unicloud.com with ESMTP id 2177sKHb055613; Mon, 7 Feb 2022 15:54:20 +0800 (GMT-8) (envelope-from luofei@unicloud.com) Received: from eage.unicloud.com ([220.194.70.35]) by spam.unicloud.com with ESMTP id 2177qtS2055331; Mon, 7 Feb 2022 15:52:55 +0800 (GMT-8) (envelope-from luofei@unicloud.com) Received: from localhost.localdomain (10.10.1.7) by zgys-ex-mb09.Unicloud.com (10.10.0.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.17; Mon, 7 Feb 2022 15:52:54 +0800 From: luofei To: , , , , , , CC: , , luofei Subject: [PATCH] x86/mm, mm/hwpoison: fix unmap kernel 1:1 pages Date: Mon, 7 Feb 2022 02:52:42 -0500 Message-ID: <20220207075242.830685-1-luofei@unicloud.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.10.1.7] X-ClientProxiedBy: zgys-ex-mb10.Unicloud.com (10.10.0.6) To zgys-ex-mb09.Unicloud.com (10.10.0.24) X-DNSRBL: X-MAIL: spam.unicloud.com 2177sKHb055613 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Only unmap the page when the memory error is properly handled by calling memory_failure(), not the other way around. Fixes: 26f8c38bb466("x86/mm, mm/hwpoison: Don't unconditionally unmap kernel 1:1 pages") Signed-off-by: luofei Cc: stable@vger.kernel.org #v4.14 --- arch/x86/kernel/cpu/mcheck/mce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 95c09db1bba2..d8399a689165 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -589,7 +589,7 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val, if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) { pfn = mce->addr >> PAGE_SHIFT; - if (memory_failure(pfn, MCE_VECTOR, 0)) + if (!memory_failure(pfn, MCE_VECTOR, 0)) mce_unmap_kpfn(pfn); } -- 2.27.0