f2fs: switch to fscrypt_file_open()
Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
6671726054
commit
2e168c82dc
|
@ -472,22 +472,10 @@ static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma)
|
||||||
|
|
||||||
static int f2fs_file_open(struct inode *inode, struct file *filp)
|
static int f2fs_file_open(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
struct dentry *dir;
|
int err = fscrypt_file_open(inode, filp);
|
||||||
|
|
||||||
if (f2fs_encrypted_inode(inode)) {
|
if (err)
|
||||||
int ret = fscrypt_get_encryption_info(inode);
|
return err;
|
||||||
if (ret)
|
|
||||||
return -EACCES;
|
|
||||||
if (!fscrypt_has_encryption_key(inode))
|
|
||||||
return -ENOKEY;
|
|
||||||
}
|
|
||||||
dir = dget_parent(file_dentry(filp));
|
|
||||||
if (f2fs_encrypted_inode(d_inode(dir)) &&
|
|
||||||
!fscrypt_has_permitted_context(d_inode(dir), inode)) {
|
|
||||||
dput(dir);
|
|
||||||
return -EPERM;
|
|
||||||
}
|
|
||||||
dput(dir);
|
|
||||||
return dquot_file_open(inode, filp);
|
return dquot_file_open(inode, filp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue