Skip to content

Commit

Permalink
ext4 crypto: make sure the encryption info is initialized on opendir(2)
Browse files Browse the repository at this point in the history
Signed-off-by: Theodore Ts'o <[email protected]>
  • Loading branch information
tytso committed May 31, 2015
1 parent 5555702 commit 6bc445e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fs/ext4/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,13 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx)
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)
Expand Down Expand Up @@ -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,
};

0 comments on commit 6bc445e

Please sign in to comment.