aboutsummaryrefslogtreecommitdiffstats
path: root/mm/nobootmem.c
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2015-02-11 15:25:25 -0800
committerBen Hutchings <ben@decadent.org.uk>2015-05-09 23:16:16 +0100
commit20f19d910265c9232d7f8ce80496c56948d0fe01 (patch)
tree64aa74f85c0ce4beac87a0f9e2f058f6221cca10 /mm/nobootmem.c
parentdc4dc270e30142f941c00f975dfb85a3a332592a (diff)
downloadkernel_samsung_smdk4412-20f19d910265c9232d7f8ce80496c56948d0fe01.zip
kernel_samsung_smdk4412-20f19d910265c9232d7f8ce80496c56948d0fe01.tar.gz
kernel_samsung_smdk4412-20f19d910265c9232d7f8ce80496c56948d0fe01.tar.bz2
mm/hugetlb: fix getting refcount 0 page in hugetlb_fault()
commit 0f792cf949a0be506c2aa8bfac0605746b146dda upstream. When running the test which causes the race as shown in the previous patch, we can hit the BUG "get_page() on refcount 0 page" in hugetlb_fault(). This race happens when pte turns into migration entry just after the first check of is_hugetlb_entry_migration() in hugetlb_fault() passed with false. To fix this, we need to check pte_present() again after huge_ptep_get(). This patch also reorders taking ptl and doing pte_page(), because pte_page() should be done in ptl. Due to this reordering, we need use trylock_page() in page != pagecache_page case to respect locking order. Fixes: 66aebce747ea ("hugetlb: fix race condition in hugetlb_fault()") Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Hugh Dickins <hughd@google.com> Cc: James Hogan <james.hogan@imgtec.com> Cc: David Rientjes <rientjes@google.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.cz> Cc: Rik van Riel <riel@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Luiz Capitulino <lcapitulino@redhat.com> Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com> Cc: Lee Schermerhorn <lee.schermerhorn@hp.com> Cc: Steve Capper <steve.capper@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> [bwh: Backported to 3.2: - Adjust context - Error label is named 'out_page_table_lock' not 'out_ptl'] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'mm/nobootmem.c')
0 files changed, 0 insertions, 0 deletions