Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
88ae4ab9
Commit
88ae4ab9
authored
Mar 28, 2016
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ecryptfs_lookup(): try either only encrypted or plaintext name
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
b1168a92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
35 deletions
+20
-35
fs/ecryptfs/inode.c
fs/ecryptfs/inode.c
+20
-35
No files found.
fs/ecryptfs/inode.c
View file @
88ae4ab9
...
...
@@ -388,55 +388,40 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode,
unsigned
int
flags
)
{
char
*
encrypted_and_encoded_name
=
NULL
;
size_t
encrypted_and_encoded_name_size
;
struct
ecryptfs_mount_crypt_stat
*
mount_crypt_stat
=
NULL
;
struct
ecryptfs_mount_crypt_stat
*
mount_crypt_stat
;
struct
dentry
*
lower_dir_dentry
,
*
lower_dentry
;
const
char
*
name
=
ecryptfs_dentry
->
d_name
.
name
;
size_t
len
=
ecryptfs_dentry
->
d_name
.
len
;
struct
dentry
*
res
;
int
rc
=
0
;
lower_dir_dentry
=
ecryptfs_dentry_to_lower
(
ecryptfs_dentry
->
d_parent
);
lower_dentry
=
lookup_one_len_unlocked
(
ecryptfs_dentry
->
d_name
.
name
,
lower_dir_dentry
,
ecryptfs_dentry
->
d_name
.
len
);
if
(
IS_ERR
(
lower_dentry
))
{
ecryptfs_printk
(
KERN_DEBUG
,
"%s: lookup_one_len() returned "
"[%ld] on lower_dentry = [%pd]
\n
"
,
__func__
,
PTR_ERR
(
lower_dentry
),
ecryptfs_dentry
);
res
=
ERR_CAST
(
lower_dentry
);
goto
out
;
}
if
(
d_really_is_positive
(
lower_dentry
))
goto
interpose
;
mount_crypt_stat
=
&
ecryptfs_superblock_to_private
(
ecryptfs_dentry
->
d_sb
)
->
mount_crypt_stat
;
if
(
!
(
mount_crypt_stat
&&
(
mount_crypt_stat
->
flags
&
ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES
)))
goto
interpose
;
dput
(
lower_dentry
);
rc
=
ecryptfs_encrypt_and_encode_filename
(
&
encrypted_and_encoded_name
,
&
encrypted_and_encoded_name_size
,
mount_crypt_stat
,
ecryptfs_dentry
->
d_name
.
name
,
ecryptfs_dentry
->
d_name
.
len
);
if
(
rc
)
{
printk
(
KERN_ERR
"%s: Error attempting to encrypt and encode "
"filename; rc = [%d]
\n
"
,
__func__
,
rc
);
res
=
ERR_PTR
(
rc
);
goto
out
;
if
(
mount_crypt_stat
&&
(
mount_crypt_stat
->
flags
&
ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES
))
{
rc
=
ecryptfs_encrypt_and_encode_filename
(
&
encrypted_and_encoded_name
,
&
len
,
mount_crypt_stat
,
name
,
len
);
if
(
rc
)
{
printk
(
KERN_ERR
"%s: Error attempting to encrypt and encode "
"filename; rc = [%d]
\n
"
,
__func__
,
rc
);
return
ERR_PTR
(
rc
);
}
name
=
encrypted_and_encoded_name
;
}
lower_dentry
=
lookup_one_len_unlocked
(
encrypted_and_encoded_name
,
lower_dir_dentry
,
encrypted_and_encoded_name_size
);
lower_dentry
=
lookup_one_len_unlocked
(
name
,
lower_dir_dentry
,
len
);
if
(
IS_ERR
(
lower_dentry
))
{
ecryptfs_printk
(
KERN_DEBUG
,
"%s: lookup_one_len() returned "
"[%ld] on lower_dentry = [%s]
\n
"
,
__func__
,
PTR_ERR
(
lower_dentry
),
encrypted_and_encoded_
name
);
name
);
res
=
ERR_CAST
(
lower_dentry
);
goto
out
;
}
else
{
res
=
ecryptfs_lookup_interpose
(
ecryptfs_dentry
,
lower_dentry
);
}
interpose:
res
=
ecryptfs_lookup_interpose
(
ecryptfs_dentry
,
lower_dentry
);
out:
kfree
(
encrypted_and_encoded_name
);
return
res
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment