aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/inode.c
diff options
context:
space:
mode:
authorTyler Hicks <tyhicks@linux.vnet.ibm.com>2010-02-11 00:17:44 -0500
committerTyler Hicks <tyhicks@linux.vnet.ibm.com>2010-03-23 13:31:09 -0400
commit1984c23f9e0cdb432d90a85ecf88b424d36878fc (patch)
tree1a4dc765c6d7f93c29c9c878d7b0a972bf49d2ac /fs/ecryptfs/inode.c
parentfa3ef1cb4e6e9958a9bfaa977c107c515907f102 (diff)
eCryptfs: Clear buffer before reading in metadata xattr
We initially read in the first PAGE_CACHE_SIZE of a file to if the eCryptfs header marker can be found. If it isn't found and ecryptfs_xattr_metadata was given as a mount option, then the user.ecryptfs xattr is read into the same buffer. Since the data from the first page of the file wasn't cleared, it is possible that we think we've found a second tag 3 or tag 1 packet and then error out after the packet contents aren't as expected. This patch clears the buffer before filling it with metadata from the user.ecryptfs xattr. Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Diffstat (limited to 'fs/ecryptfs/inode.c')
-rw-r--r--fs/ecryptfs/inode.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index a50efb18701c..ddbd096c7406 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -323,6 +323,7 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry,
323 rc = ecryptfs_read_and_validate_header_region(page_virt, 323 rc = ecryptfs_read_and_validate_header_region(page_virt,
324 ecryptfs_dentry->d_inode); 324 ecryptfs_dentry->d_inode);
325 if (rc) { 325 if (rc) {
326 memset(page_virt, 0, PAGE_CACHE_SIZE);
326 rc = ecryptfs_read_and_validate_xattr_region(page_virt, 327 rc = ecryptfs_read_and_validate_xattr_region(page_virt,
327 ecryptfs_dentry); 328 ecryptfs_dentry);
328 if (rc) { 329 if (rc) {