Commit c2faccaf authored by Theodore Ts'o's avatar Theodore Ts'o

ext4 crypto: enforce crypto policy restrictions on cross-renames

Thanks to Chao Yu <chao2.yu@samsung.com> for pointing out the need for
this check.
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent e709e9df
...@@ -3647,6 +3647,15 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -3647,6 +3647,15 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
u8 new_file_type; u8 new_file_type;
int retval; int retval;
if ((ext4_encrypted_inode(old_dir) ||
ext4_encrypted_inode(new_dir)) &&
(old_dir != new_dir) &&
(!ext4_is_child_context_consistent_with_parent(new_dir,
old.inode) ||
!ext4_is_child_context_consistent_with_parent(old_dir,
new.inode)))
return -EPERM;
dquot_initialize(old.dir); dquot_initialize(old.dir);
dquot_initialize(new.dir); dquot_initialize(new.dir);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment