summaryrefslogtreecommitdiffstats
path: root/fs/ext4/dir.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2016-02-07 19:35:05 -0500
committerTheodore Ts'o <tytso@mit.edu>2016-02-07 19:35:05 -0500
commit28b4c263961c47da84ed8b5be0b5116bad1133eb (patch)
treecf169b33d19264de0af048876e0276f06430f726 /fs/ext4/dir.c
parent36f90b0a2ddd60823fe193a85e60ff1906c2a9b3 (diff)
downloadop-kernel-dev-28b4c263961c47da84ed8b5be0b5116bad1133eb.zip
op-kernel-dev-28b4c263961c47da84ed8b5be0b5116bad1133eb.tar.gz
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>
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 1d1bca7..6d17f31 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -111,6 +111,12 @@ static int ext4_readdir(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) {
OpenPOWER on IntegriCloud