diff options
author | Mika Penttilä <mika.penttila@nextfour.com> | 2016-03-15 22:56:45 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-16 00:55:16 +0100 |
commit | 9cb65bc3b1114004e2ccee5939031325c7bf16e8 (patch) | |
tree | 9bf1f9abfb604f6d98bf9b8a641a5b8d6733fc53 /mm/memory.c | |
parent | mm/mempolicy.c: skip VM_HUGETLB and VM_MIXEDMAP VMA for lazy mbind (diff) | |
download | linux-9cb65bc3b1114004e2ccee5939031325c7bf16e8.tar.xz linux-9cb65bc3b1114004e2ccee5939031325c7bf16e8.zip |
mm/memory.c: make apply_to_page_range() more robust
Arm and arm64 used to trigger this BUG_ON() - this has now been fixed.
But a WARN_ON() here is sufficient to catch future buggy callers.
Signed-off-by: Mika Penttilä <mika.penttila@nextfour.com>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c index 8132787ae4d5..8adb5b756264 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1876,7 +1876,9 @@ int apply_to_page_range(struct mm_struct *mm, unsigned long addr, unsigned long end = addr + size; int err; - BUG_ON(addr >= end); + if (WARN_ON(addr >= end)) + return -EINVAL; + pgd = pgd_offset(mm, addr); do { next = pgd_addr_end(addr, end); |