From: Michael Halcrow Date: Wed, 27 Jun 2007 21:09:45 +0000 (-0700) Subject: zero out last page for llseek/write X-Git-Tag: v2.6.22-rc7~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4c5cdb3e099da7cc64df622b02ff7659babe16e;p=platform%2Fupstream%2Fkernel-adaptation-pc.git zero out last page for llseek/write When one llseek's past the end of the file and then writes, every page past the previous end of the file should be cleared. Trevor found that the code, as is, does not assure that the very last page is always cleared. This patch takes care of that. Signed-off-by: Michael Halcrow Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index 6df410c..7d5a43c 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c @@ -422,6 +422,8 @@ static int ecryptfs_prepare_write(struct file *file, struct page *page, goto out; } } + if (end_of_prev_pg_pos + 1 > i_size_read(page->mapping->host)) + zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0); } out: return rc;