Commit a7560fc8 authored by Wu Fengguang's avatar Wu Fengguang Committed by Andi Kleen

HWPOISON: return ENXIO on invalid page number

Use a different errno than the usual EIO for invalid page numbers.
This is mainly for better reporting for the injector.

This also avoids calling action_result() with invalid pfn.
Signed-off-by: default avatarWu Fengguang <fengguang.wu@intel.com>
Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
parent 9b9a29ec
...@@ -618,13 +618,11 @@ static struct page_state { ...@@ -618,13 +618,11 @@ static struct page_state {
static void action_result(unsigned long pfn, char *msg, int result) static void action_result(unsigned long pfn, char *msg, int result)
{ {
struct page *page = NULL; struct page *page = pfn_to_page(pfn);
if (pfn_valid(pfn))
page = pfn_to_page(pfn);
printk(KERN_ERR "MCE %#lx: %s%s page recovery: %s\n", printk(KERN_ERR "MCE %#lx: %s%s page recovery: %s\n",
pfn, pfn,
page && PageDirty(page) ? "dirty " : "", PageDirty(page) ? "dirty " : "",
msg, action_name[result]); msg, action_name[result]);
} }
...@@ -750,8 +748,10 @@ int __memory_failure(unsigned long pfn, int trapno, int ref) ...@@ -750,8 +748,10 @@ int __memory_failure(unsigned long pfn, int trapno, int ref)
panic("Memory failure from trap %d on page %lx", trapno, pfn); panic("Memory failure from trap %d on page %lx", trapno, pfn);
if (!pfn_valid(pfn)) { if (!pfn_valid(pfn)) {
action_result(pfn, "memory outside kernel control", IGNORED); printk(KERN_ERR
return -EIO; "MCE %#lx: memory outside kernel control\n",
pfn);
return -ENXIO;
} }
p = pfn_to_page(pfn); p = pfn_to_page(pfn);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment