diff options
| author | Chao Yu <yuchao0@huawei.com> | 2016-07-03 22:05:11 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-26 09:42:46 +0100 |
| commit | 70c357851b019d234d4af290febe06ed2563ccb9 (patch) | |
| tree | 437ad00cc444be9ca98bd8595fb1f45f104d19b4 /include/linux/debugobjects.h | |
| parent | 4aa4ce1c4ad5e46994de309543d9177fa3b65301 (diff) | |
f2fs: fix to avoid reading out encrypted data in page cache
commit 78682f79447998369a85f12b6437fa8fdbbdca50 upstream.
For encrypted inode, if user overwrites data of the inode, f2fs will read
encrypted data into page cache, and then do the decryption.
However reader can race with overwriter, and it will see encrypted data
which has not been decrypted by overwriter yet. Fix it by moving decrypting
work to background and keep page non-uptodated until data is decrypted.
Thread A Thread B
- f2fs_file_write_iter
- __generic_file_write_iter
- generic_perform_write
- f2fs_write_begin
- f2fs_submit_page_bio
- generic_file_read_iter
- do_generic_file_read
- lock_page_killable
- unlock_page
- copy_page_to_iter
hit the encrypted data in updated page
- lock_page
- fscrypt_decrypt_page
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
[bwh: Backported to 4.4:
- Keep using f2fs_crypto functions instead of generic fscrypt API
- Use PAGE_CACHE_SIZE instead of PAGE_SIZE
- Use submit_bio() instead of __submit_bio()
- In f2fs_write_begin(), use dn.data_blkaddr instead of blkaddr
- Adjust context]
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/debugobjects.h')
0 files changed, 0 insertions, 0 deletions
