From: Hillf Danton Date: Mon, 24 Oct 2011 14:58:12 +0000 (+1100) Subject: mm/huge_memory: fix copying user highpage X-Git-Tag: next-20111025~2^2~167 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0a31a0a3efcee5159aa29a467635b9a3f1c5cdce;p=karo-tx-linux.git mm/huge_memory: fix copying user highpage The THP copy-on-write handler falls back to regular-sized pages for a huge page replacement upon allocation failure or if THP has been individually disabled in the target VMA. The loop responsible for copying page-sized chunks accidentally uses multiples of PAGE_SHIFT instead of PAGE_SIZE as the virtual address arg for copy_user_highpage(). Signed-off-by: Hillf Danton Acked-by: Johannes Weiner Reviewed-by: Andrea Arcangeli Signed-off-by: Andrew Morton --- diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 2a6f14c4bad9..7aa9a7fbd997 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -830,7 +830,7 @@ static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm, for (i = 0; i < HPAGE_PMD_NR; i++) { copy_user_highpage(pages[i], page + i, - haddr + PAGE_SHIFT*i, vma); + haddr + PAGE_SIZE * i, vma); __SetPageUptodate(pages[i]); cond_resched(); }