diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-08-22 21:18:00 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-20 18:45:57 +0100 |
commit | 23ad83c399b0ac62b6e8cd10352119f3b4116c0b (patch) | |
tree | bf1d1ae748b42542bfe15a78d7edd819d9e51351 /fs/f2fs/segment.c | |
parent | b6410b95c22467e5315294b48f1e4b47f13f4d47 (diff) | |
download | linux-stable-23ad83c399b0ac62b6e8cd10352119f3b4116c0b.tar.gz linux-stable-23ad83c399b0ac62b6e8cd10352119f3b4116c0b.tar.bz2 linux-stable-23ad83c399b0ac62b6e8cd10352119f3b4116c0b.zip |
f2fs: avoid wrong decrypted data from disk
[ Upstream commit 0ded69f632bb717be9aeea3ae74e29050fcb060c ]
1. Create a file in an encrypted directory
2. Do GC & drop caches
3. Read stale data before its bio for metapage was not issued yet
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r-- | fs/f2fs/segment.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 10d5dcdb34be..d78009694f3f 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -3214,10 +3214,14 @@ void f2fs_wait_on_page_writeback(struct page *page, } } -void f2fs_wait_on_block_writeback(struct f2fs_sb_info *sbi, block_t blkaddr) +void f2fs_wait_on_block_writeback(struct inode *inode, block_t blkaddr) { + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct page *cpage; + if (!f2fs_post_read_required(inode)) + return; + if (!is_valid_data_blkaddr(sbi, blkaddr)) return; |