diff options
Diffstat (limited to 'fs/ecryptfs/inode.c')
-rw-r--r-- | fs/ecryptfs/inode.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 6b45b2908f17..bbc1b4f666fe 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -289,6 +289,7 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry, | |||
289 | char *encoded_name; | 289 | char *encoded_name; |
290 | unsigned int encoded_namelen; | 290 | unsigned int encoded_namelen; |
291 | struct ecryptfs_crypt_stat *crypt_stat = NULL; | 291 | struct ecryptfs_crypt_stat *crypt_stat = NULL; |
292 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat; | ||
292 | char *page_virt = NULL; | 293 | char *page_virt = NULL; |
293 | struct inode *lower_inode; | 294 | struct inode *lower_inode; |
294 | u64 file_size; | 295 | u64 file_size; |
@@ -388,8 +389,18 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry, | |||
388 | } | 389 | } |
389 | crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR; | 390 | crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR; |
390 | } | 391 | } |
391 | memcpy(&file_size, page_virt, sizeof(file_size)); | 392 | mount_crypt_stat = &ecryptfs_superblock_to_private( |
392 | file_size = be64_to_cpu(file_size); | 393 | dentry->d_sb)->mount_crypt_stat; |
394 | if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) { | ||
395 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | ||
396 | file_size = (crypt_stat->header_extent_size | ||
397 | + i_size_read(lower_dentry->d_inode)); | ||
398 | else | ||
399 | file_size = i_size_read(lower_dentry->d_inode); | ||
400 | } else { | ||
401 | memcpy(&file_size, page_virt, sizeof(file_size)); | ||
402 | file_size = be64_to_cpu(file_size); | ||
403 | } | ||
393 | i_size_write(dentry->d_inode, (loff_t)file_size); | 404 | i_size_write(dentry->d_inode, (loff_t)file_size); |
394 | kmem_cache_free(ecryptfs_header_cache_2, page_virt); | 405 | kmem_cache_free(ecryptfs_header_cache_2, page_virt); |
395 | goto out; | 406 | goto out; |