diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-28 17:10:43 -0400 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-28 17:10:43 -0400 | 
| commit | e933424c4823596ed231648eeb602b5209960ff6 (patch) | |
| tree | d1bec768605bd4cc91326b80a02fa6472384bf08 | |
| parent | 8f2a0029b8aaed9fb37d775dbe527e163920b129 (diff) | |
| parent | 93c3fe40c279f002906ad14584c30671097d4394 (diff) | |
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
| -rw-r--r-- | fs/ecryptfs/crypto.c | 3 | ||||
| -rw-r--r-- | fs/ecryptfs/inode.c | 31 | ||||
| -rw-r--r-- | fs/ecryptfs/keystore.c | 2 | ||||
| -rw-r--r-- | fs/ecryptfs/kthread.c | 2 | ||||
| -rw-r--r-- | fs/ecryptfs/messaging.c | 2 | ||||
| -rw-r--r-- | fs/ecryptfs/miscdev.c | 2 | 
6 files changed, 30 insertions, 12 deletions
| diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index a2e3b562e65d..cbadc1bee6e7 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
| @@ -1793,7 +1793,7 @@ struct kmem_cache *ecryptfs_key_tfm_cache; | |||
| 1793 | static struct list_head key_tfm_list; | 1793 | static struct list_head key_tfm_list; | 
| 1794 | struct mutex key_tfm_list_mutex; | 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 | mutex_init(&key_tfm_list_mutex); | 1798 | mutex_init(&key_tfm_list_mutex); | 
| 1799 | INIT_LIST_HEAD(&key_tfm_list); | 1799 | INIT_LIST_HEAD(&key_tfm_list); | 
| @@ -2169,7 +2169,6 @@ int ecryptfs_encrypt_and_encode_filename( | |||
| 2169 | (ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE | 2169 | (ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE | 
| 2170 | + encoded_name_no_prefix_size); | 2170 | + encoded_name_no_prefix_size); | 
| 2171 | (*encoded_name)[(*encoded_name_size)] = '\0'; | 2171 | (*encoded_name)[(*encoded_name_size)] = '\0'; | 
| 2172 | (*encoded_name_size)++; | ||
| 2173 | } else { | 2172 | } else { | 
| 2174 | rc = -EOPNOTSUPP; | 2173 | rc = -EOPNOTSUPP; | 
| 2175 | } | 2174 | } | 
| diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 6c55113e7222..3fbc94203380 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
| @@ -349,7 +349,7 @@ out: | |||
| 349 | 349 | ||
| 350 | /** | 350 | /** | 
| 351 | * ecryptfs_new_lower_dentry | 351 | * ecryptfs_new_lower_dentry | 
| 352 | * @ename: The name of the new dentry. | 352 | * @name: The name of the new dentry. | 
| 353 | * @lower_dir_dentry: Parent directory of the new dentry. | 353 | * @lower_dir_dentry: Parent directory of the new dentry. | 
| 354 | * @nd: nameidata from last lookup. | 354 | * @nd: nameidata from last lookup. | 
| 355 | * | 355 | * | 
| @@ -386,20 +386,19 @@ ecryptfs_new_lower_dentry(struct qstr *name, struct dentry *lower_dir_dentry, | |||
| 386 | * ecryptfs_lookup_one_lower | 386 | * ecryptfs_lookup_one_lower | 
| 387 | * @ecryptfs_dentry: The eCryptfs dentry that we are looking up | 387 | * @ecryptfs_dentry: The eCryptfs dentry that we are looking up | 
| 388 | * @lower_dir_dentry: lower parent directory | 388 | * @lower_dir_dentry: lower parent directory | 
| 389 | * @name: lower file name | ||
| 389 | * | 390 | * | 
| 390 | * Get the lower dentry from vfs. If lower dentry does not exist yet, | 391 | * Get the lower dentry from vfs. If lower dentry does not exist yet, | 
| 391 | * create it. | 392 | * create it. | 
| 392 | */ | 393 | */ | 
| 393 | static struct dentry * | 394 | static struct dentry * | 
| 394 | ecryptfs_lookup_one_lower(struct dentry *ecryptfs_dentry, | 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 | struct nameidata nd; | 398 | struct nameidata nd; | 
| 398 | struct vfsmount *lower_mnt; | 399 | struct vfsmount *lower_mnt; | 
| 399 | struct qstr *name; | ||
| 400 | int err; | 400 | int err; | 
| 401 | 401 | ||
| 402 | name = &ecryptfs_dentry->d_name; | ||
| 403 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt( | 402 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt( | 
| 404 | ecryptfs_dentry->d_parent)); | 403 | ecryptfs_dentry->d_parent)); | 
| 405 | err = vfs_path_lookup(lower_dir_dentry, lower_mnt, name->name , 0, &nd); | 404 | err = vfs_path_lookup(lower_dir_dentry, lower_mnt, name->name , 0, &nd); | 
| @@ -434,6 +433,7 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
| 434 | size_t encrypted_and_encoded_name_size; | 433 | size_t encrypted_and_encoded_name_size; | 
| 435 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat = NULL; | 434 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat = NULL; | 
| 436 | struct dentry *lower_dir_dentry, *lower_dentry; | 435 | struct dentry *lower_dir_dentry, *lower_dentry; | 
| 436 | struct qstr lower_name; | ||
| 437 | int rc = 0; | 437 | int rc = 0; | 
| 438 | 438 | ||
| 439 | ecryptfs_dentry->d_op = &ecryptfs_dops; | 439 | ecryptfs_dentry->d_op = &ecryptfs_dops; | 
| @@ -444,9 +444,17 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
| 444 | goto out_d_drop; | 444 | goto out_d_drop; | 
| 445 | } | 445 | } | 
| 446 | lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); | 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 | lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, | 456 | lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, | 
| 449 | lower_dir_dentry); | 457 | lower_dir_dentry, &lower_name); | 
| 450 | if (IS_ERR(lower_dentry)) { | 458 | if (IS_ERR(lower_dentry)) { | 
| 451 | rc = PTR_ERR(lower_dentry); | 459 | rc = PTR_ERR(lower_dentry); | 
| 452 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned " | 460 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned " | 
| @@ -471,8 +479,17 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
| 471 | "filename; rc = [%d]\n", __func__, rc); | 479 | "filename; rc = [%d]\n", __func__, rc); | 
| 472 | goto out_d_drop; | 480 | goto out_d_drop; | 
| 473 | } | 481 | } | 
| 482 | lower_name.name = encrypted_and_encoded_name; | ||
| 483 | lower_name.len = encrypted_and_encoded_name_size; | ||
| 484 | lower_name.hash = full_name_hash(lower_name.name, lower_name.len); | ||
| 485 | if (lower_dir_dentry->d_op && lower_dir_dentry->d_op->d_hash) { | ||
| 486 | rc = lower_dir_dentry->d_op->d_hash(lower_dir_dentry, | ||
| 487 | &lower_name); | ||
| 488 | if (rc < 0) | ||
| 489 | goto out_d_drop; | ||
| 490 | } | ||
| 474 | lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, | 491 | lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, | 
| 475 | lower_dir_dentry); | 492 | lower_dir_dentry, &lower_name); | 
| 476 | if (IS_ERR(lower_dentry)) { | 493 | if (IS_ERR(lower_dentry)) { | 
| 477 | rc = PTR_ERR(lower_dentry); | 494 | rc = PTR_ERR(lower_dentry); | 
| 478 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned " | 495 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned " | 
| diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index 89c5476506ef..73811cfa2ea4 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c | |||
| @@ -515,6 +515,7 @@ ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes, | |||
| 515 | if (!s) { | 515 | if (!s) { | 
| 516 | printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " | 516 | printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " | 
| 517 | "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); | 517 | "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); | 
| 518 | rc = -ENOMEM; | ||
| 518 | goto out; | 519 | goto out; | 
| 519 | } | 520 | } | 
| 520 | s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; | 521 | s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; | 
| @@ -806,6 +807,7 @@ ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size, | |||
| 806 | if (!s) { | 807 | if (!s) { | 
| 807 | printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " | 808 | printk(KERN_ERR "%s: Out of memory whilst trying to kmalloc " | 
| 808 | "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); | 809 | "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); | 
| 810 | rc = -ENOMEM; | ||
| 809 | goto out; | 811 | goto out; | 
| 810 | } | 812 | } | 
| 811 | s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; | 813 | s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; | 
| diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c index d8c3a373aafa..0851ab6980f5 100644 --- a/fs/ecryptfs/kthread.c +++ b/fs/ecryptfs/kthread.c | |||
| @@ -86,7 +86,7 @@ out: | |||
| 86 | return 0; | 86 | return 0; | 
| 87 | } | 87 | } | 
| 88 | 88 | ||
| 89 | int ecryptfs_init_kthread(void) | 89 | int __init ecryptfs_init_kthread(void) | 
| 90 | { | 90 | { | 
| 91 | int rc = 0; | 91 | int rc = 0; | 
| 92 | 92 | ||
| diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c index bcb68c0cb1f0..ab2248090515 100644 --- a/fs/ecryptfs/messaging.c +++ b/fs/ecryptfs/messaging.c | |||
| @@ -473,7 +473,7 @@ sleep: | |||
| 473 | return rc; | 473 | return rc; | 
| 474 | } | 474 | } | 
| 475 | 475 | ||
| 476 | int ecryptfs_init_messaging(void) | 476 | int __init ecryptfs_init_messaging(void) | 
| 477 | { | 477 | { | 
| 478 | int i; | 478 | int i; | 
| 479 | int rc = 0; | 479 | int rc = 0; | 
| diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c index 3745f612bcd4..00208c3d7e92 100644 --- a/fs/ecryptfs/miscdev.c +++ b/fs/ecryptfs/miscdev.c | |||
| @@ -500,7 +500,7 @@ static struct miscdevice ecryptfs_miscdev = { | |||
| 500 | * | 500 | * | 
| 501 | * Returns zero on success; non-zero otherwise | 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 | int rc; | 505 | int rc; | 
| 506 | 506 | ||
