summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorChandan Rajendra2019-05-20 18:29:49 +0200
committerEric Biggers2019-05-28 19:27:53 +0200
commit7e0785fce14f75976a80b241d732e210e380923e (patch)
tree130615e4d12af19cadf76844ba4a1dcc3ec97827 /fs/ext4
parentfscrypt: decrypt only the needed blocks in __fscrypt_decrypt_bio() (diff)
downloadkernel-qcow2-linux-7e0785fce14f75976a80b241d732e210e380923e.tar.gz
kernel-qcow2-linux-7e0785fce14f75976a80b241d732e210e380923e.tar.xz
kernel-qcow2-linux-7e0785fce14f75976a80b241d732e210e380923e.zip
ext4: clear BH_Uptodate flag on decryption error
If decryption fails, ext4_block_write_begin() can return with the page's buffer_head marked with the BH_Uptodate flag. This commit clears the BH_Uptodate flag in such cases. Signed-off-by: Chandan Rajendra <chandan@linux.ibm.com> Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/inode.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 8bfd8941f5ff..92776d0ff9b9 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1229,10 +1229,14 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,
if (!buffer_uptodate(*wait_bh))
err = -EIO;
}
- if (unlikely(err))
+ if (unlikely(err)) {
page_zero_new_buffers(page, from, to);
- else if (decrypt)
+ } else if (decrypt) {
err = fscrypt_decrypt_pagecache_blocks(page, PAGE_SIZE, 0);
+ if (err)
+ clear_buffer_uptodate(*wait_bh);
+ }
+
return err;
}
#endif