diff options
| author | Kinglong Mee <kinglongmee@gmail.com> | 2017-03-15 21:12:50 +0800 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2017-05-21 18:38:42 +0200 |
| commit | 851ed22ea79934ce8ca1d45511da40cbea0d931e (patch) | |
| tree | 5c0d7856f528fcb468f8e20616c749d283eb3724 | |
| parent | 16c6b865402ccf24c864b55f5d2efcc5f8b5ba62 (diff) | |
f2fs: sanity check of crc_offset from raw checkpoint
The crc_offset towards or beyond the end of block is wrong,
sanity check it.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
| -rw-r--r-- | fs/f2fs/checkpoint.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 26fa815a3..ff5a35415 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -680,7 +680,7 @@ static int get_checkpoint_version(struct f2fs_sb_info *sbi, block_t cp_addr, *cp_block = (struct f2fs_checkpoint *)page_address(*cp_page); crc_offset = le32_to_cpu((*cp_block)->checksum_offset); - if (crc_offset >= blk_size) { + if (crc_offset > (blk_size - sizeof(__le32))) { f2fs_msg(sbi->sb, KERN_WARNING, "invalid crc_offset: %zu", crc_offset); return -EINVAL; |
