提交 09a5c31c 编写于 作者: E Eric Biggers 提交者: Theodore Ts'o

ext4: switch to fscrypt_file_open()

Signed-off-by: NEric Biggers <ebiggers@google.com>
Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
上级 815dac33
...@@ -364,7 +364,6 @@ static int ext4_file_open(struct inode * inode, struct file * filp) ...@@ -364,7 +364,6 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
struct vfsmount *mnt = filp->f_path.mnt; struct vfsmount *mnt = filp->f_path.mnt;
struct dentry *dir;
struct path path; struct path path;
char buf[64], *cp; char buf[64], *cp;
int ret; int ret;
...@@ -404,25 +403,11 @@ static int ext4_file_open(struct inode * inode, struct file * filp) ...@@ -404,25 +403,11 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
ext4_journal_stop(handle); ext4_journal_stop(handle);
} }
} }
if (ext4_encrypted_inode(inode)) {
ret = fscrypt_get_encryption_info(inode);
if (ret)
return -EACCES;
if (!fscrypt_has_encryption_key(inode))
return -ENOKEY;
}
dir = dget_parent(file_dentry(filp)); ret = fscrypt_file_open(inode, filp);
if (ext4_encrypted_inode(d_inode(dir)) && if (ret)
!fscrypt_has_permitted_context(d_inode(dir), inode)) { return ret;
ext4_warning(inode->i_sb,
"Inconsistent encryption contexts: %lu/%lu",
(unsigned long) d_inode(dir)->i_ino,
(unsigned long) inode->i_ino);
dput(dir);
return -EPERM;
}
dput(dir);
/* /*
* Set up the jbd2_inode if we are opening the inode for * Set up the jbd2_inode if we are opening the inode for
* writing and the journal is present * writing and the journal is present
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册