aboutsummaryrefslogtreecommitdiffstats
path: root/mm/hwpoison-inject.c
diff options
context:
space:
mode:
authorluofei <[email protected]>2022-03-22 21:44:38 +0000
committerLinus Torvalds <[email protected]>2022-03-22 22:57:07 +0000
commitd1fe111fb62a1cf0446a2919f5effbb33ad0702c (patch)
tree6574928df84f4ec14b01945db7c003748bf092a0 /mm/hwpoison-inject.c
parentmm/hwpoison-inject: support injecting hwpoison to free page (diff)
downloadkernel-d1fe111fb62a1cf0446a2919f5effbb33ad0702c.tar.gz
kernel-d1fe111fb62a1cf0446a2919f5effbb33ad0702c.zip
mm/hwpoison: avoid the impact of hwpoison_filter() return value on mce handler
When the hwpoison page meets the filter conditions, it should not be regarded as successful memory_failure() processing for mce handler, but should return a distinct value, otherwise mce handler regards the error page has been identified and isolated, which may lead to calling set_mce_nospec() to change page attribute, etc. Here memory_failure() return -EOPNOTSUPP to indicate that the error event is filtered, mce handler should not take any action for this situation and hwpoison injector should treat as correct. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: luofei <[email protected]> Acked-by: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Miaohe Lin <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tony Luck <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'mm/hwpoison-inject.c')
-rw-r--r--mm/hwpoison-inject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c
index f74552977649..bb0cea5468cb 100644
--- a/mm/hwpoison-inject.c
+++ b/mm/hwpoison-inject.c
@@ -48,7 +48,8 @@ static int hwpoison_inject(void *data, u64 val)
inject:
pr_info("Injecting memory failure at pfn %#lx\n", pfn);
- return memory_failure(pfn, 0);
+ err = memory_failure(pfn, 0);
+ return (err == -EOPNOTSUPP) ? 0 : err;
}
static int hwpoison_unpoison(void *data, u64 val)