add patch set-lazytime-on-remount
[ext4-patch-queue.git] / set-up-crypt-info-on-opendir
blobbbf64de67c41379e00f4b78fbda850573bbb08e3
1 ext4 crypto: make sure the encryption info is initialized on opendir(2)
3 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
4 ---
5  fs/ext4/dir.c | 8 ++++++++
6  1 file changed, 8 insertions(+)
8 diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
9 index e11e6ae..f9e1491 100644
10 --- a/fs/ext4/dir.c
11 +++ b/fs/ext4/dir.c
12 @@ -593,6 +593,13 @@ finished:
13         return 0;
14  }
16 +static int ext4_dir_open(struct inode * inode, struct file * filp)
18 +       if (ext4_encrypted_inode(inode))
19 +               return ext4_get_encryption_info(inode) ? -EACCES : 0;
20 +       return 0;
23  static int ext4_release_dir(struct inode *inode, struct file *filp)
24  {
25         if (filp->private_data)
26 @@ -635,5 +642,6 @@ const struct file_operations ext4_dir_operations = {
27         .compat_ioctl   = ext4_compat_ioctl,
28  #endif
29         .fsync          = ext4_sync_file,
30 +       .open           = ext4_dir_open,
31         .release        = ext4_release_dir,
32  };