summaryrefslogtreecommitdiff
path: root/fs/ext4/namei.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2015-05-18 20:15:47 +0300
committerTheodore Ts'o <tytso@mit.edu>2015-05-18 20:15:47 +0300
commitd229959072eba40e1c2a4f53f8af17f1e770eb66 (patch)
tree1321587e2ae72863ac6f06d5ca7df6c809186937 /fs/ext4/namei.c
parent5b643f9ce34df945e58c7176275d406aa0db704f (diff)
downloadlinux-d229959072eba40e1c2a4f53f8af17f1e770eb66.tar.xz
ext4 crypto: don't allocate a page when encrypting/decrypting file names
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r--fs/ext4/namei.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 56c60cb2d3fe..b3406434c267 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -998,6 +998,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,
hinfo->hash, hinfo->minor_hash, de,
&tmp_str);
} else {
+ int save_len = fname_crypto_str.len;
+
/* Directory is encrypted */
err = ext4_fname_disk_to_usr(ctx, hinfo, de,
&fname_crypto_str);
@@ -1008,6 +1010,7 @@ static int htree_dirblock_to_tree(struct file *dir_file,
err = ext4_htree_store_dirent(dir_file,
hinfo->hash, hinfo->minor_hash, de,
&fname_crypto_str);
+ fname_crypto_str.len = save_len;
}
if (err != 0) {
count = err;
@@ -3126,6 +3129,7 @@ static int ext4_symlink(struct inode *dir,
istr.name = (const unsigned char *) symname;
istr.len = len;
ostr.name = sd->encrypted_path;
+ ostr.len = disk_link.len;
err = ext4_fname_usr_to_disk(ctx, &istr, &ostr);
ext4_put_fname_crypto_ctx(&ctx);
if (err < 0)