From: KAMEZAWA Hiroyuki Date: Tue, 10 Jan 2012 23:07:22 +0000 (-0800) Subject: mm/hugetlb.c: fix virtual address handling in hugetlb fault X-Git-Tag: v3.3-rc1~113^2~110 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e16a539ac16e7b3a8c2cee188897d4bdb88e6e8;p=platform%2Fupstream%2Fkernel-adaptation-pc.git mm/hugetlb.c: fix virtual address handling in hugetlb fault handle_mm_fault() passes 'faulted' address to hugetlb_fault(). This address is not aligned to a hugepage boundary. Most of the functions for hugetlb pages are aware of that and calculate an alignment themselves. However some functions such as copy_user_huge_page() and clear_huge_page() don't handle alignment by themselves. This patch make hugeltb_fault() fix the alignment and pass an aligned addresss (to address of a faulted hugepage) to functions. [akpm@linux-foundation.org: use &=] Signed-off-by: KAMEZAWA Hiroyuki Cc: KOSAKI Motohiro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 49e693b..ab89d6f 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2640,6 +2640,8 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, static DEFINE_MUTEX(hugetlb_instantiation_mutex); struct hstate *h = hstate_vma(vma); + address &= huge_page_mask(h); + ptep = huge_pte_offset(mm, address); if (ptep) { entry = huge_ptep_get(ptep);