• Hugh Dickins's avatar
    [PATCH] do_munmap() hugetlb fix · 3c5533e1
    Hugh Dickins authored
    The hugetlb_page test in do_munmap is too permissive.  It checks start vma,
    but forgets that end vma might be different and huge though start is not:
    so hits unmap_hugepage_range BUG if misaligned end was given.
    
    And it's too restrictive: munmap has always succeeded on unmapped areas
    within its range, why should it behave differently near a hugepage vma?
    
    And the additional checks in is_aligned_hugepage_range are irrelevant here,
    when the hugepage vma already exists.  But the function is still required
    (on some arches), as the default for prepare_hugepage_range - leave
    renaming cleanup to another occasion.
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Acked-by: default avatarWilliam Irwin <wli@holomorphy.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    3c5533e1
mmap.c 54.3 KB