aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/main.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-08-02 13:56:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-08-02 13:56:34 -0400
commit410fc4ce8a373a3c35c73ac2c7c29f2bac6400bf (patch)
tree8a9e2e29f13a3ba93689f4afb951d64ffc10c9d5 /fs/ecryptfs/main.c
parent630103ea2c286de3e7ea9ae6b1035d91ef051413 (diff)
parent5f5b331d5c21228a6519dcb793fc1629646c51a6 (diff)
Merge tag 'ecryptfs-3.6-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs
Pull ecryptfs fixes from Tyler Hicks: - Fixes a bug when the lower filesystem mount options include 'acl', but the eCryptfs mount options do not - Cleanups in the messaging code - Better handling of empty files in the lower filesystem to improve usability. Failed file creations are now cleaned up and empty lower files are converted into eCryptfs during open(). - The write-through cache changes are being reverted due to bugs that are not easy to fix. Stability outweighs the performance enhancements here. - Improvement to the mount code to catch unsupported ciphers specified in the mount options * tag 'ecryptfs-3.6-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs: eCryptfs: check for eCryptfs cipher support at mount eCryptfs: Revert to a writethrough cache model eCryptfs: Initialize empty lower files when opening them eCryptfs: Unlink lower inode when ecryptfs_create() fails eCryptfs: Make all miscdev functions use daemon ptr in file private_data eCryptfs: Remove unused messaging declarations and function eCryptfs: Copy up POSIX ACL and read-only flags from lower mount
Diffstat (limited to 'fs/ecryptfs/main.c')
-rw-r--r--fs/ecryptfs/main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 1c0b3b6b75c6..2768138eefee 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -279,6 +279,7 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options,
279 char *fnek_src; 279 char *fnek_src;
280 char *cipher_key_bytes_src; 280 char *cipher_key_bytes_src;
281 char *fn_cipher_key_bytes_src; 281 char *fn_cipher_key_bytes_src;
282 u8 cipher_code;
282 283
283 *check_ruid = 0; 284 *check_ruid = 0;
284 285
@@ -420,6 +421,18 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options,
420 && !fn_cipher_key_bytes_set) 421 && !fn_cipher_key_bytes_set)
421 mount_crypt_stat->global_default_fn_cipher_key_bytes = 422 mount_crypt_stat->global_default_fn_cipher_key_bytes =
422 mount_crypt_stat->global_default_cipher_key_size; 423 mount_crypt_stat->global_default_cipher_key_size;
424
425 cipher_code = ecryptfs_code_for_cipher_string(
426 mount_crypt_stat->global_default_cipher_name,
427 mount_crypt_stat->global_default_cipher_key_size);
428 if (!cipher_code) {
429 ecryptfs_printk(KERN_ERR,
430 "eCryptfs doesn't support cipher: %s",
431 mount_crypt_stat->global_default_cipher_name);
432 rc = -EINVAL;
433 goto out;
434 }
435
423 mutex_lock(&key_tfm_list_mutex); 436 mutex_lock(&key_tfm_list_mutex);
424 if (!ecryptfs_tfm_exists(mount_crypt_stat->global_default_cipher_name, 437 if (!ecryptfs_tfm_exists(mount_crypt_stat->global_default_cipher_name,
425 NULL)) { 438 NULL)) {
@@ -540,6 +553,15 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
540 } 553 }
541 554
542 ecryptfs_set_superblock_lower(s, path.dentry->d_sb); 555 ecryptfs_set_superblock_lower(s, path.dentry->d_sb);
556
557 /**
558 * Set the POSIX ACL flag based on whether they're enabled in the lower
559 * mount. Force a read-only eCryptfs mount if the lower mount is ro.
560 * Allow a ro eCryptfs mount even when the lower mount is rw.
561 */
562 s->s_flags = flags & ~MS_POSIXACL;
563 s->s_flags |= path.dentry->d_sb->s_flags & (MS_RDONLY | MS_POSIXACL);
564
543 s->s_maxbytes = path.dentry->d_sb->s_maxbytes; 565 s->s_maxbytes = path.dentry->d_sb->s_maxbytes;
544 s->s_blocksize = path.dentry->d_sb->s_blocksize; 566 s->s_blocksize = path.dentry->d_sb->s_blocksize;
545 s->s_magic = ECRYPTFS_SUPER_MAGIC; 567 s->s_magic = ECRYPTFS_SUPER_MAGIC;