aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@google.com>2017-02-13 09:22:36 -0800
committerMister Oyster <oysterized@gmail.com>2017-05-27 19:40:06 +0200
commit9913acb29c876c8f95f19dc352e7b3db0a014261 (patch)
treea530acdaa33dc6b9ec2b49642b7a2415203b19fb
parent7c5937ef56c1c2eaa120f8ec8762bba519d62d20 (diff)
ANDROID: ext4 crypto: Disables zeroing on truncation when there's no key
When performing orphan cleanup on mount, ext4 may truncate pages. Truncation as currently implemented may require the encryption key for partial zeroing, and the key isn't necessarily available on mount. Since the userspace tools don't perform the partial zeroing operation anyway, let's just skip doing that in the kernel. This patch fixes a BUG_ON() oops. Bug: 35209576 Change-Id: I2527a3f8d2c57d2de5df03fda69ee397f76095d7 Signed-off-by: Michael Halcrow <mhalcrow@google.com>
-rw-r--r--fs/ext4/inode.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 0d8ffe543..3d8e37507 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3433,6 +3433,11 @@ static int ext4_block_truncate_page(handle_t *handle,
unsigned blocksize;
struct inode *inode = mapping->host;
+ /* If we are processing an encrypted inode during orphan list
+ * handling */
+ if (ext4_encrypted_inode(inode) && !ext4_has_encryption_key(inode))
+ return 0;
+
blocksize = inode->i_sb->s_blocksize;
length = blocksize - (offset & (blocksize - 1));