diff options
author | Eric Biggers <ebiggers@google.com> | 2019-05-20 12:29:48 -0400 |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2019-05-28 13:27:53 -0400 |
commit | ffceeefb337b3ba9da36633072490caa96289345 (patch) | |
tree | 0849a49406848038682382fabe20684ff0cccdd2 /fs/crypto/bio.c | |
parent | aa8bc1ac6ef32a332671ca25e06cfd277a3839a5 (diff) |
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>
Diffstat (limited to 'fs/crypto/bio.c')
-rw-r--r-- | fs/crypto/bio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c index 61da06fda45c..82da2510721f 100644 --- a/fs/crypto/bio.c +++ b/fs/crypto/bio.c | |||
@@ -33,8 +33,8 @@ static void __fscrypt_decrypt_bio(struct bio *bio, bool done) | |||
33 | 33 | ||
34 | bio_for_each_segment_all(bv, bio, iter_all) { | 34 | bio_for_each_segment_all(bv, bio, iter_all) { |
35 | struct page *page = bv->bv_page; | 35 | struct page *page = bv->bv_page; |
36 | int ret = fscrypt_decrypt_pagecache_blocks(page, PAGE_SIZE, 0); | 36 | int ret = fscrypt_decrypt_pagecache_blocks(page, bv->bv_len, |
37 | 37 | bv->bv_offset); | |
38 | if (ret) | 38 | if (ret) |
39 | SetPageError(page); | 39 | SetPageError(page); |
40 | else if (done) | 40 | else if (done) |