diff options
author | Tyler Hicks <tyhicks@linux.vnet.ibm.com> | 2010-02-11 08:10:38 -0500 |
---|---|---|
committer | Tyler Hicks <tyhicks@linux.vnet.ibm.com> | 2010-03-23 13:29:49 -0400 |
commit | 157f1071354db1aed885816094888e0e257c9d0a (patch) | |
tree | 711d00d7dce97f846342db0a27b4a61c6b1966a4 /fs/ecryptfs/ecryptfs_kernel.h | |
parent | 220bf991b0366cc50a94feede3d7341fa5710ee4 (diff) |
eCryptfs: Fix metadata in xattr feature regression
Fixes regression in 8faece5f906725c10e7a1f6caf84452abadbdc7b
When using the ecryptfs_xattr_metadata mount option, eCryptfs stores the
metadata (normally stored at the front of the file) in the user.ecryptfs
xattr. This causes ecryptfs_crypt_stat.num_header_bytes_at_front to be
0, since there is no header data at the front of the file. This results
in too much memory being requested and ENOMEM being returned from
ecryptfs_write_metadata().
This patch fixes the problem by using the num_header_bytes_at_front
variable for specifying the max size of the metadata, despite whether it
is stored in the header or xattr.
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Diffstat (limited to 'fs/ecryptfs/ecryptfs_kernel.h')
-rw-r--r-- | fs/ecryptfs/ecryptfs_kernel.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 542f625312f3..8456f70606ad 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
@@ -464,6 +464,14 @@ struct ecryptfs_daemon { | |||
464 | 464 | ||
465 | extern struct mutex ecryptfs_daemon_hash_mux; | 465 | extern struct mutex ecryptfs_daemon_hash_mux; |
466 | 466 | ||
467 | static inline size_t | ||
468 | ecryptfs_lower_header_size(struct ecryptfs_crypt_stat *crypt_stat) | ||
469 | { | ||
470 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | ||
471 | return 0; | ||
472 | return crypt_stat->num_header_bytes_at_front; | ||
473 | } | ||
474 | |||
467 | static inline struct ecryptfs_file_info * | 475 | static inline struct ecryptfs_file_info * |
468 | ecryptfs_file_to_private(struct file *file) | 476 | ecryptfs_file_to_private(struct file *file) |
469 | { | 477 | { |