diff options
| author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-02-23 09:21:37 -0800 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-13 12:33:12 +0200 |
| commit | 1cc29dbd803898cec3bd2011aa1db4ddb2cf8932 (patch) | |
| tree | 16c1ea21af68c45af22c9cf5450601fe354d3daf /fs/f2fs/file.c | |
| parent | 5fae04a05333a3e0d93273a0d3848117b77cd6ec (diff) | |
| download | android_kernel_m2note-1cc29dbd803898cec3bd2011aa1db4ddb2cf8932.tar.gz | |
f2fs crypto: sync ext4_lookup and ext4_file_open
This patch tries to catch up with lookup and open policies in ext4.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
| -rw-r--r-- | fs/f2fs/file.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index f4498398f..79eda1689 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -460,6 +460,7 @@ static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma) static int f2fs_file_open(struct inode *inode, struct file *filp) { int ret = generic_file_open(inode, filp); + struct inode *dir = filp->f_path.dentry->d_parent->d_inode; if (!ret && f2fs_encrypted_inode(inode)) { ret = fscrypt_get_encryption_info(inode); @@ -468,6 +469,9 @@ static int f2fs_file_open(struct inode *inode, struct file *filp) if (!fscrypt_has_encryption_key(inode)) return -ENOKEY; } + if (f2fs_encrypted_inode(dir) && + !fscrypt_has_permitted_context(dir, inode)) + return -EPERM; return ret; } |
