From 337d9abf1cd1a59645d91b6d0b1685a476b81978 Mon Sep 17 00:00:00 2001 From: Naoya Horiguchi Date: Tue, 26 Jul 2016 15:24:03 -0700 Subject: mm: thp: check pmd_trans_unstable() after split_huge_pmd() split_huge_pmd() doesn't guarantee that the pmd is normal pmd pointing to pte entries, which can be checked with pmd_trans_unstable(). Some callers make this assertion and some do it differently and some not, so let's do it in a unified manner. Link: http://lkml.kernel.org/r/1464741400-12143-1-git-send-email-n-horiguchi@ah.jp.nec.com Signed-off-by: Naoya Horiguchi Cc: "Kirill A. Shutemov" Cc: Hugh Dickins Cc: Mel Gorman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/gup.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mm/gup.c') diff --git a/mm/gup.c b/mm/gup.c index c057784c8444..dee142e100f4 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -279,6 +279,8 @@ struct page *follow_page_mask(struct vm_area_struct *vma, spin_unlock(ptl); ret = 0; split_huge_pmd(vma, pmd, address); + if (pmd_trans_unstable(pmd)) + ret = -EBUSY; } else { get_page(page); spin_unlock(ptl); -- cgit v1.2.3