diff options
author | David Gstir <david@sigma-star.at> | 2016-11-13 22:20:48 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-11-13 20:18:16 -0500 |
commit | 9c4bb8a3a9b4de21753053d667310c2b7cb39916 (patch) | |
tree | f384bbd76dfc293f2cc66c770c5ccfdbc42c43c8 /fs/ext4/inode.c | |
parent | 0b93e1b94b86f826d18a2aaf219a53e271274d49 (diff) | |
download | linux-9c4bb8a3a9b4de21753053d667310c2b7cb39916.tar.gz linux-9c4bb8a3a9b4de21753053d667310c2b7cb39916.tar.bz2 linux-9c4bb8a3a9b4de21753053d667310c2b7cb39916.zip |
fscrypt: Let fs select encryption index/tweak
Avoid re-use of page index as tweak for AES-XTS when multiple parts of
same page are encrypted. This will happen on multiple (partial) calls of
fscrypt_encrypt_page on same page.
page->index is only valid for writeback pages.
Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 1d498c5e2990..1485ac273bfb 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1167,7 +1167,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len, page_zero_new_buffers(page, from, to); else if (decrypt) err = fscrypt_decrypt_page(page->mapping->host, page, - PAGE_SIZE, 0); + PAGE_SIZE, 0, page->index); return err; } #endif @@ -3746,7 +3746,7 @@ static int __ext4_block_zero_page_range(handle_t *handle, BUG_ON(blocksize != PAGE_SIZE); BUG_ON(!PageLocked(page)); WARN_ON_ONCE(fscrypt_decrypt_page(page->mapping->host, - page, PAGE_SIZE, 0)); + page, PAGE_SIZE, 0, page->index)); } } if (ext4_should_journal_data(inode)) { |