1
0
Fork 0

fscrypt: decrypt only the needed blocks in __fscrypt_decrypt_bio()

In __fscrypt_decrypt_bio(), only decrypt the blocks that actually
comprise the bio, rather than assuming blocksize == PAGE_SIZE and
decrypting the entirety of every page used in the bio.

This is in preparation for allowing encryption on ext4 filesystems with
blocksize != PAGE_SIZE.

This is based on work by Chandan Rajendra.

Reviewed-by: Chandan Rajendra <chandan@linux.ibm.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
alistair/sunxi64-5.4-dsi
Eric Biggers 2019-05-20 09:29:48 -07:00
parent aa8bc1ac6e
commit ffceeefb33
1 changed files with 2 additions and 2 deletions

View File

@ -33,8 +33,8 @@ static void __fscrypt_decrypt_bio(struct bio *bio, bool done)
bio_for_each_segment_all(bv, bio, iter_all) {
struct page *page = bv->bv_page;
int ret = fscrypt_decrypt_pagecache_blocks(page, PAGE_SIZE, 0);
int ret = fscrypt_decrypt_pagecache_blocks(page, bv->bv_len,
bv->bv_offset);
if (ret)
SetPageError(page);
else if (done)