diff options
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r-- | fs/ecryptfs/inode.c | 11 | ||||
-rw-r--r-- | fs/ecryptfs/main.c | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 49121e5a8de2..5c36ceecb5c1 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -593,11 +593,16 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, lower_new_dir_dentry = dget_parent(lower_new_dentry); target_inode = d_inode(new_dentry); trap = lock_rename(lower_old_dir_dentry, lower_new_dir_dentry); + rc = -EINVAL; + if (lower_old_dentry->d_parent != lower_old_dir_dentry) + goto out_lock; + if (lower_new_dentry->d_parent != lower_new_dir_dentry) + goto out_lock; + if (d_unhashed(lower_old_dentry) || d_unhashed(lower_new_dentry)) + goto out_lock; /* source should not be ancestor of target */ - if (trap == lower_old_dentry) { - rc = -EINVAL; + if (trap == lower_old_dentry) goto out_lock; - } /* target should not be ancestor of source */ if (trap == lower_new_dentry) { rc = -ENOTEMPTY; diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 025d66a705db..5d029b7e069a 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c @@ -488,7 +488,7 @@ static struct file_system_type ecryptfs_fs_type; * @raw_data: The options passed into the kernel */ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags, - const char *dev_name, void *raw_data) + const char *dev_name, void *raw_data, size_t data_size) { struct super_block *s; struct ecryptfs_sb_info *sbi; |