• H
    [PATCH] mm: hugetlb truncation fixes · 1c59827d
    Hugh Dickins 提交于
    hugetlbfs allows truncation of its files (should it?), but hugetlb.c often
    forgets that: crashes and misaccounting ensue.
    
    copy_hugetlb_page_range better grab the src page_table_lock since we don't
    want to guess what happens if concurrently truncated.  unmap_hugepage_range
    rss accounting must not assume the full range was mapped.  follow_hugetlb_page
    must guard with page_table_lock and be prepared to exit early.
    
    Restyle copy_hugetlb_page_range with a for loop like the others there.
    Signed-off-by: NHugh Dickins <hugh@veritas.com>
    Signed-off-by: NAndrew Morton <akpm@osdl.org>
    Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
    1c59827d
hugetlb.c 10.3 KB