summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluofei <luofei@unicloud.com>2022-02-07 22:20:28 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-11 08:43:36 +0100
commit92f72aed87c029beed9e4093c4a13d1fc746ac90 (patch)
tree0c5a3227679a8c261d34adcaf5c2045234de539b
parente6f580d0b3349646d4ee1ce0057eb273e8fb7e2e (diff)
x86/mm, mm/hwpoison: Fix the unmap kernel 1:1 pages check condition
When fd0e786d9d09 ("x86/mm, mm/hwpoison: Don't unconditionally unmap kernel 1:1 pages") was backported to 4.14.y, the logic was reversed when calling memory_failure() to determine whether it needs to unmap the kernel page. Only when memory_failure() returns successfully, the kernel page can be unmapped. Signed-off-by: luofei <luofei@unicloud.com> Cc: stable@vger.kernel.org #v4.14.x Cc: stable@vger.kernel.org #v4.15.x Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c2
1 files changed, 1 insertions, 1 deletions
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);
}