]> git.baikalelectronics.ru Git - kernel.git/commit
[PATCH] invalidate_complete_page() race fix
authorAndrew Morton <akpm@osdl.org>
Fri, 8 Sep 2006 16:48:38 +0000 (09:48 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 8 Sep 2006 17:22:50 +0000 (10:22 -0700)
commit02d75e54d195833c8eed14a5e6e0afca12d70380
tree574ead6bd03d31ca7036ff2389cb0400f3fd63fc
parent1cd3e1400e6c89ee06e760b7570663a33f3a73d1
[PATCH] invalidate_complete_page() race fix

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: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/truncate.c