aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ecryptfs/main.c')
-rw-r--r--fs/ecryptfs/main.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 0249aa4ae181..d25ac9500a92 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -117,7 +117,7 @@ void __ecryptfs_printk(const char *fmt, ...)
117 * 117 *
118 * Returns zero on success; non-zero otherwise 118 * Returns zero on success; non-zero otherwise
119 */ 119 */
120int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry) 120static int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry)
121{ 121{
122 struct ecryptfs_inode_info *inode_info = 122 struct ecryptfs_inode_info *inode_info =
123 ecryptfs_inode_to_private(ecryptfs_dentry->d_inode); 123 ecryptfs_inode_to_private(ecryptfs_dentry->d_inode);
@@ -226,17 +226,15 @@ out:
226 return rc; 226 return rc;
227} 227}
228 228
229enum { ecryptfs_opt_sig, ecryptfs_opt_ecryptfs_sig, ecryptfs_opt_debug, 229enum { ecryptfs_opt_sig, ecryptfs_opt_ecryptfs_sig,
230 ecryptfs_opt_ecryptfs_debug, ecryptfs_opt_cipher, 230 ecryptfs_opt_cipher, ecryptfs_opt_ecryptfs_cipher,
231 ecryptfs_opt_ecryptfs_cipher, ecryptfs_opt_ecryptfs_key_bytes, 231 ecryptfs_opt_ecryptfs_key_bytes,
232 ecryptfs_opt_passthrough, ecryptfs_opt_xattr_metadata, 232 ecryptfs_opt_passthrough, ecryptfs_opt_xattr_metadata,
233 ecryptfs_opt_encrypted_view, ecryptfs_opt_err }; 233 ecryptfs_opt_encrypted_view, ecryptfs_opt_err };
234 234
235static match_table_t tokens = { 235static match_table_t tokens = {
236 {ecryptfs_opt_sig, "sig=%s"}, 236 {ecryptfs_opt_sig, "sig=%s"},
237 {ecryptfs_opt_ecryptfs_sig, "ecryptfs_sig=%s"}, 237 {ecryptfs_opt_ecryptfs_sig, "ecryptfs_sig=%s"},
238 {ecryptfs_opt_debug, "debug=%u"},
239 {ecryptfs_opt_ecryptfs_debug, "ecryptfs_debug=%u"},
240 {ecryptfs_opt_cipher, "cipher=%s"}, 238 {ecryptfs_opt_cipher, "cipher=%s"},
241 {ecryptfs_opt_ecryptfs_cipher, "ecryptfs_cipher=%s"}, 239 {ecryptfs_opt_ecryptfs_cipher, "ecryptfs_cipher=%s"},
242 {ecryptfs_opt_ecryptfs_key_bytes, "ecryptfs_key_bytes=%u"}, 240 {ecryptfs_opt_ecryptfs_key_bytes, "ecryptfs_key_bytes=%u"},
@@ -313,7 +311,6 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options)
313 substring_t args[MAX_OPT_ARGS]; 311 substring_t args[MAX_OPT_ARGS];
314 int token; 312 int token;
315 char *sig_src; 313 char *sig_src;
316 char *debug_src;
317 char *cipher_name_dst; 314 char *cipher_name_dst;
318 char *cipher_name_src; 315 char *cipher_name_src;
319 char *cipher_key_bytes_src; 316 char *cipher_key_bytes_src;
@@ -341,16 +338,6 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options)
341 } 338 }
342 sig_set = 1; 339 sig_set = 1;
343 break; 340 break;
344 case ecryptfs_opt_debug:
345 case ecryptfs_opt_ecryptfs_debug:
346 debug_src = args[0].from;
347 ecryptfs_verbosity =
348 (int)simple_strtol(debug_src, &debug_src,
349 0);
350 ecryptfs_printk(KERN_DEBUG,
351 "Verbosity set to [%d]" "\n",
352 ecryptfs_verbosity);
353 break;
354 case ecryptfs_opt_cipher: 341 case ecryptfs_opt_cipher:
355 case ecryptfs_opt_ecryptfs_cipher: 342 case ecryptfs_opt_ecryptfs_cipher:
356 cipher_name_src = args[0].from; 343 cipher_name_src = args[0].from;
@@ -423,9 +410,13 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options)
423 if (!cipher_key_bytes_set) { 410 if (!cipher_key_bytes_set) {
424 mount_crypt_stat->global_default_cipher_key_size = 0; 411 mount_crypt_stat->global_default_cipher_key_size = 0;
425 } 412 }
426 rc = ecryptfs_add_new_key_tfm( 413 mutex_lock(&key_tfm_list_mutex);
427 NULL, mount_crypt_stat->global_default_cipher_name, 414 if (!ecryptfs_tfm_exists(mount_crypt_stat->global_default_cipher_name,
428 mount_crypt_stat->global_default_cipher_key_size); 415 NULL))
416 rc = ecryptfs_add_new_key_tfm(
417 NULL, mount_crypt_stat->global_default_cipher_name,
418 mount_crypt_stat->global_default_cipher_key_size);
419 mutex_unlock(&key_tfm_list_mutex);
429 if (rc) { 420 if (rc) {
430 printk(KERN_ERR "Error attempting to initialize cipher with " 421 printk(KERN_ERR "Error attempting to initialize cipher with "
431 "name = [%s] and key size = [%td]; rc = [%d]\n", 422 "name = [%s] and key size = [%td]; rc = [%d]\n",
@@ -522,8 +513,8 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
522 ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n"); 513 ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n");
523 goto out; 514 goto out;
524 } 515 }
525 lower_root = nd.dentry; 516 lower_root = nd.path.dentry;
526 lower_mnt = nd.mnt; 517 lower_mnt = nd.path.mnt;
527 ecryptfs_set_superblock_lower(sb, lower_root->d_sb); 518 ecryptfs_set_superblock_lower(sb, lower_root->d_sb);
528 sb->s_maxbytes = lower_root->d_sb->s_maxbytes; 519 sb->s_maxbytes = lower_root->d_sb->s_maxbytes;
529 sb->s_blocksize = lower_root->d_sb->s_blocksize; 520 sb->s_blocksize = lower_root->d_sb->s_blocksize;
@@ -535,7 +526,7 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
535 rc = 0; 526 rc = 0;
536 goto out; 527 goto out;
537out_free: 528out_free:
538 path_release(&nd); 529 path_put(&nd.path);
539out: 530out:
540 return rc; 531 return rc;
541} 532}
@@ -654,11 +645,6 @@ static struct ecryptfs_cache_info {
654 .size = sizeof(struct ecryptfs_sb_info), 645 .size = sizeof(struct ecryptfs_sb_info),
655 }, 646 },
656 { 647 {
657 .cache = &ecryptfs_header_cache_0,
658 .name = "ecryptfs_headers_0",
659 .size = PAGE_CACHE_SIZE,
660 },
661 {
662 .cache = &ecryptfs_header_cache_1, 648 .cache = &ecryptfs_header_cache_1,
663 .name = "ecryptfs_headers_1", 649 .name = "ecryptfs_headers_1",
664 .size = PAGE_CACHE_SIZE, 650 .size = PAGE_CACHE_SIZE,
@@ -821,6 +807,10 @@ static int __init ecryptfs_init(void)
821 "rc = [%d]\n", rc); 807 "rc = [%d]\n", rc);
822 goto out_release_messaging; 808 goto out_release_messaging;
823 } 809 }
810 if (ecryptfs_verbosity > 0)
811 printk(KERN_CRIT "eCryptfs verbosity set to %d. Secret values "
812 "will be written to the syslog!\n", ecryptfs_verbosity);
813
824 goto out; 814 goto out;
825out_release_messaging: 815out_release_messaging:
826 ecryptfs_release_messaging(ecryptfs_transport); 816 ecryptfs_release_messaging(ecryptfs_transport);