aboutsummaryrefslogtreecommitdiffstats
path: root/mm/hwpoison-inject.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/hwpoison-inject.c')
-rw-r--r--mm/hwpoison-inject.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c
index 329caf56df22..4ca5fe0042e1 100644
--- a/mm/hwpoison-inject.c
+++ b/mm/hwpoison-inject.c
@@ -34,13 +34,13 @@ static int hwpoison_inject(void *data, u64 val)
34 if (!hwpoison_filter_enable) 34 if (!hwpoison_filter_enable)
35 goto inject; 35 goto inject;
36 36
37 if (!PageLRU(p) && !PageHuge(p)) 37 if (!PageLRU(hpage) && !PageHuge(p))
38 shake_page(p, 0); 38 shake_page(hpage, 0);
39 /* 39 /*
40 * This implies unable to support non-LRU pages. 40 * This implies unable to support non-LRU pages.
41 */ 41 */
42 if (!PageLRU(p) && !PageHuge(p)) 42 if (!PageLRU(hpage) && !PageHuge(p))
43 return 0; 43 goto put_out;
44 44
45 /* 45 /*
46 * do a racy check with elevated page count, to make sure PG_hwpoison 46 * do a racy check with elevated page count, to make sure PG_hwpoison
@@ -52,11 +52,14 @@ static int hwpoison_inject(void *data, u64 val)
52 err = hwpoison_filter(hpage); 52 err = hwpoison_filter(hpage);
53 unlock_page(hpage); 53 unlock_page(hpage);
54 if (err) 54 if (err)
55 return 0; 55 goto put_out;
56 56
57inject: 57inject:
58 pr_info("Injecting memory failure at pfn %#lx\n", pfn); 58 pr_info("Injecting memory failure at pfn %#lx\n", pfn);
59 return memory_failure(pfn, 18, MF_COUNT_INCREASED); 59 return memory_failure(pfn, 18, MF_COUNT_INCREASED);
60put_out:
61 put_page(hpage);
62 return 0;
60} 63}
61 64
62static int hwpoison_unpoison(void *data, u64 val) 65static int hwpoison_unpoison(void *data, u64 val)