Skip to content

Commit 0747fdb

Browse files
author
Al Viro
committed
ecryptfs: switch ecryptfs_decode_and_decrypt_filename() from dentry to sb
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent cb5e05d commit 0747fdb

4 files changed

Lines changed: 8 additions & 10 deletions

File tree

‎fs/ecryptfs/crypto.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,12 +2243,11 @@ int ecryptfs_encrypt_and_encode_filename(
22432243
*/
22442244
int ecryptfs_decode_and_decrypt_filename(char **plaintext_name,
22452245
size_t *plaintext_name_size,
2246-
struct dentry *ecryptfs_dir_dentry,
2246+
struct super_block *sb,
22472247
const char *name, size_t name_size)
22482248
{
22492249
struct ecryptfs_mount_crypt_stat *mount_crypt_stat =
2250-
&ecryptfs_superblock_to_private(
2251-
ecryptfs_dir_dentry->d_sb)->mount_crypt_stat;
2250+
&ecryptfs_superblock_to_private(sb)->mount_crypt_stat;
22522251
char *decoded_name;
22532252
size_t decoded_name_size;
22542253
size_t packet_size;

‎fs/ecryptfs/ecryptfs_kernel.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry,
575575
struct inode *ecryptfs_inode);
576576
int ecryptfs_decode_and_decrypt_filename(char **decrypted_name,
577577
size_t *decrypted_name_size,
578-
struct dentry *ecryptfs_dentry,
578+
struct super_block *sb,
579579
const char *name, size_t name_size);
580580
int ecryptfs_fill_zeros(struct file *file, loff_t new_length);
581581
int ecryptfs_encrypt_and_encode_filename(

‎fs/ecryptfs/file.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb,
7070
struct ecryptfs_getdents_callback {
7171
struct dir_context ctx;
7272
struct dir_context *caller;
73-
struct dentry *dentry;
73+
struct super_block *sb;
7474
int filldir_called;
7575
int entries_written;
7676
};
@@ -88,7 +88,7 @@ ecryptfs_filldir(void *dirent, const char *lower_name, int lower_namelen,
8888

8989
buf->filldir_called++;
9090
rc = ecryptfs_decode_and_decrypt_filename(&name, &name_size,
91-
buf->dentry, lower_name,
91+
buf->sb, lower_name,
9292
lower_namelen);
9393
if (rc) {
9494
printk(KERN_ERR "%s: Error attempting to decode and decrypt "
@@ -114,15 +114,14 @@ static int ecryptfs_readdir(struct file *file, struct dir_context *ctx)
114114
{
115115
int rc;
116116
struct file *lower_file;
117-
struct inode *inode;
117+
struct inode *inode = file_inode(file);
118118
struct ecryptfs_getdents_callback buf = {
119119
.ctx.actor = ecryptfs_filldir,
120120
.caller = ctx,
121-
.dentry = file->f_path.dentry
121+
.sb = inode->i_sb,
122122
};
123123
lower_file = ecryptfs_file_to_lower(file);
124124
lower_file->f_pos = ctx->pos;
125-
inode = file_inode(file);
126125
rc = iterate_dir(lower_file, &buf.ctx);
127126
ctx->pos = buf.ctx.pos;
128127
if (rc < 0)

‎fs/ecryptfs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ static int ecryptfs_readlink_lower(struct dentry *dentry, char **buf,
679679
set_fs(old_fs);
680680
if (rc < 0)
681681
goto out;
682-
rc = ecryptfs_decode_and_decrypt_filename(buf, bufsiz, dentry,
682+
rc = ecryptfs_decode_and_decrypt_filename(buf, bufsiz, dentry->d_sb,
683683
lower_buf, rc);
684684
out:
685685
kfree(lower_buf);

0 commit comments

Comments
 (0)