aboutsummaryrefslogtreecommitdiff
path: root/fs/ext4/dir.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2016-02-07 19:35:05 -0500
committerMister Oyster <oysterized@gmail.com>2017-05-29 03:52:06 +0200
commit1487abde26ae07c507d95f4a59021b2f647e64f1 (patch)
treea589facb5e481b13cf9abf2450312d18a69364b1 /fs/ext4/dir.c
parent72e896d8d5698abc18c4e22995edabc242a7fa62 (diff)
ext4 crypto: revalidate dentry after adding or removing the key
Add a validation check for dentries for encrypted directory to make sure we're not caching stale data after a key has been added or removed. Also check to make sure that status of the encryption key is updated when readdir(2) is executed. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Theodore Ts'o <tytso@google.com> Change-Id: Ic7a90d79d9447272fc512ae2abbd299523de02b8
Diffstat (limited to 'fs/ext4/dir.c')
-rw-r--r--fs/ext4/dir.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index f5a0f088c..c3230fbdd 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -115,6 +115,12 @@ static int ext4_readdir2(struct file *file, struct dir_context *ctx)
int dir_has_error = 0;
struct ext4_str fname_crypto_str = {.name = NULL, .len = 0};
+ if (ext4_encrypted_inode(inode)) {
+ err = ext4_get_encryption_info(inode);
+ if (err && err != -ENOKEY)
+ return err;
+ }
+
if (is_dx_dir(inode)) {
err = ext4_dx_readdir(file, ctx);
if (err != ERR_BAD_DX_DIR) {