diff mbox series

[4.14,3/3] x86/mm, mm/hwpoison: Fix the unmap kernel 1:1 pages check condition

Message ID 20220209191248.771916077@linuxfoundation.org
State New
Headers show
Series None | expand

Commit Message

Greg KH Feb. 9, 2022, 7:13 p.m. UTC
From: luofei <luofei@unicloud.com>

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>
---
 arch/x86/kernel/cpu/mcheck/mce.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

--- 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 n
 
 	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);
 	}