提交 d4c5cdb3 编写于 作者: M Michael Halcrow 提交者: Linus Torvalds

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: NMichael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e10f281b
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册