diff options
author | Theodore Ts'o <tytso@mit.edu> | 2016-02-08 01:35:05 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-02-08 01:35:05 +0100 |
commit | 28b4c263961c47da84ed8b5be0b5116bad1133eb (patch) | |
tree | cf169b33d19264de0af048876e0276f06430f726 /fs/ext4/dir.c | |
parent | Linux 4.5-rc2 (diff) | |
download | linux-28b4c263961c47da84ed8b5be0b5116bad1133eb.tar.xz linux-28b4c263961c47da84ed8b5be0b5116bad1133eb.zip |
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.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index 1d1bca74f844..6d17f31a31d7 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) { |