aboutsummaryrefslogtreecommitdiffstats
path: root/mm/madvise.c
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2009-12-16 06:20:00 -0500
committerAndi Kleen <ak@linux.intel.com>2009-12-16 06:20:00 -0500
commitd15f107d97bd74c74d8f5144843d372666ddbdac (patch)
tree6c12d3c738c3118ccab724b5b984fc07c7e58082 /mm/madvise.c
parent1bfe5febe34d2be2120803c10720e179186357c9 (diff)
HWPOISON: Use get_user_page_fast in hwpoison madvise
The previous version didn't take the mmap_sem before calling gup(), which is racy. Use get_user_pages_fast() instead which doesn't need any locks. This is also faster of course, but then it doesn't really matter because this is just a testing path. Based on report from Nick Piggin. Cc: npiggin@suse.de Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'mm/madvise.c')
-rw-r--r--mm/madvise.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/madvise.c b/mm/madvise.c
index 6ca34f0cd4aa..7964e36ba915 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -230,8 +230,7 @@ static int madvise_hwpoison(unsigned long start, unsigned long end)
230 return -EPERM; 230 return -EPERM;
231 for (; start < end; start += PAGE_SIZE) { 231 for (; start < end; start += PAGE_SIZE) {
232 struct page *p; 232 struct page *p;
233 int ret = get_user_pages(current, current->mm, start, 1, 233 int ret = get_user_pages_fast(start, 1, 0, &p);
234 0, 0, &p, NULL);
235 if (ret != 1) 234 if (ret != 1)
236 return ret; 235 return ret;
237 printk(KERN_INFO "Injecting memory failure for page %lx at %lx\n", 236 printk(KERN_INFO "Injecting memory failure for page %lx at %lx\n",