summaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@google.com>2015-04-12 00:56:10 -0400
committerTheodore Ts'o <tytso@mit.edu>2015-04-12 00:56:10 -0400
commitc9c7429c2e486f375bddd0c338cc3ad366123717 (patch)
treeb9cc5749676e272856e930f3086e4965839c44ea /fs/ext4/inode.c
parent2058f83a728adffbe00bded4f804b37a5ee58cbe (diff)
downloadlinux-c9c7429c2e486f375bddd0c338cc3ad366123717.tar.bz2
ext4 crypto: implement the ext4 decryption read path
Signed-off-by: Michael Halcrow <mhalcrow@google.com> Signed-off-by: Ildar Muslukhov <ildarm@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 7c4527e10ae4..8b4fe626919a 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3370,6 +3370,13 @@ static int __ext4_block_zero_page_range(handle_t *handle,
/* Uhhuh. Read error. Complain and punt. */
if (!buffer_uptodate(bh))
goto unlock;
+ if (S_ISREG(inode->i_mode) &&
+ ext4_encrypted_inode(inode)) {
+ /* We expect the key to be set. */
+ BUG_ON(!ext4_has_encryption_key(inode));
+ BUG_ON(blocksize != PAGE_CACHE_SIZE);
+ WARN_ON_ONCE(ext4_decrypt_one(inode, page));
+ }
}
if (ext4_should_journal_data(inode)) {
BUFFER_TRACE(bh, "get write access");