Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs/ecryptfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs/ecryptfs-2.6:
eCryptfs: Fix encrypted file name lookup regression
ecryptfs: properly mark init functions
fs/ecryptfs: Return -ENOMEM on memory allocation failure

+30 -12
+1 -2
fs/ecryptfs/crypto.c
··· 1793 1793 static struct list_head key_tfm_list; 1794 1794 struct mutex key_tfm_list_mutex; 1795 1795 1796 - int ecryptfs_init_crypto(void) 1796 + int __init ecryptfs_init_crypto(void) 1797 1797 { 1798 1798 mutex_init(&key_tfm_list_mutex); 1799 1799 INIT_LIST_HEAD(&key_tfm_list); ··· 2169 2169 (ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE 2170 2170 + encoded_name_no_prefix_size); 2171 2171 (*encoded_name)[(*encoded_name_size)] = '\0'; 2172 - (*encoded_name_size)++; 2173 2172 } else { 2174 2173 rc = -EOPNOTSUPP; 2175 2174 }
+24 -7
fs/ecryptfs/inode.c
··· 349 349 350 350 /** 351 351 * ecryptfs_new_lower_dentry 352 - * @ename: The name of the new dentry. 352 + * @name: The name of the new dentry. 353 353 * @lower_dir_dentry: Parent directory of the new dentry. 354 354 * @nd: nameidata from last lookup. 355 355 * ··· 386 386 * ecryptfs_lookup_one_lower 387 387 * @ecryptfs_dentry: The eCryptfs dentry that we are looking up 388 388 * @lower_dir_dentry: lower parent directory 389 + * @name: lower file name 389 390 * 390 391 * Get the lower dentry from vfs. If lower dentry does not exist yet, 391 392 * create it. 392 393 */ 393 394 static struct dentry * 394 395 ecryptfs_lookup_one_lower(struct dentry *ecryptfs_dentry, 395 - struct dentry *lower_dir_dentry) 396 + struct dentry *lower_dir_dentry, struct qstr *name) 396 397 { 397 398 struct nameidata nd; 398 399 struct vfsmount *lower_mnt; 399 - struct qstr *name; 400 400 int err; 401 401 402 - name = &ecryptfs_dentry->d_name; 403 402 lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt( 404 403 ecryptfs_dentry->d_parent)); 405 404 err = vfs_path_lookup(lower_dir_dentry, lower_mnt, name->name , 0, &nd); ··· 433 434 size_t encrypted_and_encoded_name_size; 434 435 struct ecryptfs_mount_crypt_stat *mount_crypt_stat = NULL; 435 436 struct dentry *lower_dir_dentry, *lower_dentry; 437 + struct qstr lower_name; 436 438 int rc = 0; 437 439 438 440 ecryptfs_dentry->d_op = &ecryptfs_dops; ··· 444 444 goto out_d_drop; 445 445 } 446 446 lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); 447 - 447 + lower_name.name = ecryptfs_dentry->d_name.name; 448 + lower_name.len = ecryptfs_dentry->d_name.len; 449 + lower_name.hash = ecryptfs_dentry->d_name.hash; 450 + if (lower_dir_dentry->d_op && lower_dir_dentry->d_op->d_hash) { 451 + rc = lower_dir_dentry->d_op->d_hash(lower_dir_dentry, 452 + &lower_name); 453 + if (rc < 0) 454 + goto out_d_drop; 455 + } 448 456 lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, 449 - lower_dir_dentry); 457 + lower_dir_dentry, &lower_name); 450 458 if (IS_ERR(lower_dentry)) { 451 459 rc = PTR_ERR(lower_dentry); 452 460 ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned " ··· 479 471 "filename; rc = [%d]\n", __func__, rc); 480 472 goto out_d_drop; 481 473 } 474 + lower_name.name = encrypted_and_encoded_name; 475 + lower_name.len = encrypted_and_encoded_name_size; 476 + lower_name.hash = full_name_hash(lower_name.name, lower_name.len); 477 + if (lower_dir_dentry->d_op && lower_dir_dentry->d_op->d_hash) { 478 + rc = lower_dir_dentry->d_op->d_hash(lower_dir_dentry, 479 + &lower_name); 480 + if (rc < 0) 481 + goto out_d_drop; 482 + } 482 483 lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, 483 - lower_dir_dentry); 484 + lower_dir_dentry, &lower_name); 484 485 if (IS_ERR(lower_dentry)) { 485 486 rc = PTR_ERR(lower_dentry); 486 487 ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned "
+2
fs/ecryptfs/keystore.c
··· 515 515 if (!s) { 516 516 printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " 517 517 "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); 518 + rc = -ENOMEM; 518 519 goto out; 519 520 } 520 521 s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; ··· 807 806 if (!s) { 808 807 printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " 809 808 "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); 809 + rc = -ENOMEM; 810 810 goto out; 811 811 } 812 812 s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
+1 -1
fs/ecryptfs/kthread.c
··· 86 86 return 0; 87 87 } 88 88 89 - int ecryptfs_init_kthread(void) 89 + int __init ecryptfs_init_kthread(void) 90 90 { 91 91 int rc = 0; 92 92
+1 -1
fs/ecryptfs/messaging.c
··· 473 473 return rc; 474 474 } 475 475 476 - int ecryptfs_init_messaging(void) 476 + int __init ecryptfs_init_messaging(void) 477 477 { 478 478 int i; 479 479 int rc = 0;
+1 -1
fs/ecryptfs/miscdev.c
··· 500 500 * 501 501 * Returns zero on success; non-zero otherwise 502 502 */ 503 - int ecryptfs_init_ecryptfs_miscdev(void) 503 + int __init ecryptfs_init_ecryptfs_miscdev(void) 504 504 { 505 505 int rc; 506 506