• Andrew Morton's avatar
    [PATCH] invalidate_complete_page() race fix · 016eb4a0
    Andrew Morton authored
    If a CPU faults this page into pagetables after invalidate_mapping_pages()
    checked page_mapped(), invalidate_complete_page() will still proceed to remove
    the page from pagecache.  This leaves the page-faulting process with a
    detached page.  If it was MAP_SHARED then file data loss will ensue.
    
    Fix that up by checking the page's refcount after taking tree_lock.
    
    Cc: Nick Piggin <nickpiggin@yahoo.com.au>
    Cc: Hugh Dickins <hugh@veritas.com>
    Cc: <stable@kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    016eb4a0
truncate.c 9.75 KB