Should rather just use the non-zeroing usercopy here, but the APIs for it don't seem to be very consistent. Signed-off-by: Nick Piggin mm/filemap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) Index: linux-2.6/mm/filemap.c =================================================================== --- linux-2.6.orig/mm/filemap.c +++ linux-2.6/mm/filemap.c @@ -2200,7 +2200,15 @@ generic_file_buffered_write(struct kiocb bytes = copied; lock_page(page); - if (unlikely(!page->mapping)) { + /* + * Can't handle the page going uptodate here, because + * that means we would use non-atomic usercopies, which + * zero out the tail of the page, which can cause + * zeroes to become transiently visible. We could just + * use a non-zeroing copy, but the APIs aren't too + * consistent. + */ + if (unlikely(!page->mapping || PageUptodate(page))) { unlock_page(page); page_cache_release(page); page_cache_release(src_page);