summaryrefslogtreecommitdiffstats
path: root/fs/ext4/file.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2017-10-18 20:21:57 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-10-18 20:21:57 -0400
commit09a5c31c919da0a83d3fa9fffaa09cf78cc2d466 (patch)
tree51920b0e48dde0cbeac929c7e4d90de11505ed6e /fs/ext4/file.c
parent815dac33b27da9efce0f6008272e69f2a1ba1a33 (diff)
ext4: switch to fscrypt_file_open()
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/file.c')
-rw-r--r--fs/ext4/file.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index b1da660ac3bc..ffe9144088f8 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -364,7 +364,6 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
364 struct super_block *sb = inode->i_sb; 364 struct super_block *sb = inode->i_sb;
365 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); 365 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
366 struct vfsmount *mnt = filp->f_path.mnt; 366 struct vfsmount *mnt = filp->f_path.mnt;
367 struct dentry *dir;
368 struct path path; 367 struct path path;
369 char buf[64], *cp; 368 char buf[64], *cp;
370 int ret; 369 int ret;
@@ -404,25 +403,11 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
404 ext4_journal_stop(handle); 403 ext4_journal_stop(handle);
405 } 404 }
406 } 405 }
407 if (ext4_encrypted_inode(inode)) {
408 ret = fscrypt_get_encryption_info(inode);
409 if (ret)
410 return -EACCES;
411 if (!fscrypt_has_encryption_key(inode))
412 return -ENOKEY;
413 }
414 406
415 dir = dget_parent(file_dentry(filp)); 407 ret = fscrypt_file_open(inode, filp);
416 if (ext4_encrypted_inode(d_inode(dir)) && 408 if (ret)
417 !fscrypt_has_permitted_context(d_inode(dir), inode)) { 409 return ret;
418 ext4_warning(inode->i_sb, 410
419 "Inconsistent encryption contexts: %lu/%lu",
420 (unsigned long) d_inode(dir)->i_ino,
421 (unsigned long) inode->i_ino);
422 dput(dir);
423 return -EPERM;
424 }
425 dput(dir);
426 /* 411 /*
427 * Set up the jbd2_inode if we are opening the inode for 412 * Set up the jbd2_inode if we are opening the inode for
428 * writing and the journal is present 413 * writing and the journal is present