summaryrefslogtreecommitdiff
path: root/fs/ext4
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2015-05-31 20:34:57 +0300
committerTheodore Ts'o <tytso@mit.edu>2015-05-31 20:34:57 +0300
commit6bc445e0ff44c7e83225124c214d350407e68ccf (patch)
treec61f7126550c87b865dc60e3bb6f809abcfd8e9e /fs/ext4
parent5555702955326ac1b9971f81569d8a6851384d49 (diff)
downloadlinux-6bc445e0ff44c7e83225124c214d350407e68ccf.tar.xz
ext4 crypto: make sure the encryption info is initialized on opendir(2)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/dir.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index e11e6ae26baa..f9e14911918c 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -593,6 +593,13 @@ finished:
return 0;
}
+static int ext4_dir_open(struct inode * inode, struct file * filp)
+{
+ if (ext4_encrypted_inode(inode))
+ return ext4_get_encryption_info(inode) ? -EACCES : 0;
+ return 0;
+}
+
static int ext4_release_dir(struct inode *inode, struct file *filp)
{
if (filp->private_data)
@@ -635,5 +642,6 @@ const struct file_operations ext4_dir_operations = {
.compat_ioctl = ext4_compat_ioctl,
#endif
.fsync = ext4_sync_file,
+ .open = ext4_dir_open,
.release = ext4_release_dir,
};