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/page-io.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/page-io.c')
-rw-r--r-- | fs/ext4/page-io.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 3d1d3d0f4303..902a3e3059b3 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -470,7 +470,8 @@ int ext4_bio_write_page(struct ext4_io_submit *io, gfp_t gfp_flags = GFP_NOFS; retry_encrypt: - data_page = fscrypt_encrypt_page(inode, page, PAGE_SIZE, 0, gfp_flags); + data_page = fscrypt_encrypt_page(inode, page, PAGE_SIZE, 0, + page->index, gfp_flags); if (IS_ERR(data_page)) { ret = PTR_ERR(data_page); if (ret == -ENOMEM && wbc->sync_mode == WB_SYNC_ALL) { |