Commit 6bc445e0 authored by Theodore Ts'o's avatar Theodore Ts'o

ext4 crypto: make sure the encryption info is initialized on opendir(2)

Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 55557029
...@@ -593,6 +593,13 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) ...@@ -593,6 +593,13 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx)
return 0; 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) static int ext4_release_dir(struct inode *inode, struct file *filp)
{ {
if (filp->private_data) if (filp->private_data)
...@@ -635,5 +642,6 @@ const struct file_operations ext4_dir_operations = { ...@@ -635,5 +642,6 @@ const struct file_operations ext4_dir_operations = {
.compat_ioctl = ext4_compat_ioctl, .compat_ioctl = ext4_compat_ioctl,
#endif #endif
.fsync = ext4_sync_file, .fsync = ext4_sync_file,
.open = ext4_dir_open,
.release = ext4_release_dir, .release = ext4_release_dir,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment