* [f2fs-dev] [PATCH v4] f2fs: avoid out-of-range memory access
@ 2019-07-08 4:34 Ocean Chen via Linux-f2fs-devel
2019-07-08 6:30 ` Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Ocean Chen via Linux-f2fs-devel @ 2019-07-08 4:34 UTC (permalink / raw)
To: jaegeuk, yuchao0, linux-f2fs-devel, linux-kernel; +Cc: oceanchen
blkoff_off might over 512 due to fs corrupt or security
vulnerability. That should be checked before being using.
Use ENTRIES_IN_SUM to protect invalid value in cur_data_blkoff.
Signed-off-by: Ocean Chen <oceanchen@google.com>
---
fs/f2fs/segment.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 8dee063c833f..ac824f6632b6 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3393,6 +3393,11 @@ static int read_compacted_summaries(struct f2fs_sb_info *sbi)
seg_i = CURSEG_I(sbi, i);
segno = le32_to_cpu(ckpt->cur_data_segno[i]);
blk_off = le16_to_cpu(ckpt->cur_data_blkoff[i]);
+ if (blk_off > ENTRIES_IN_SUM) {
+ f2fs_bug_on(sbi, 1);
+ f2fs_put_page(page, 1);
+ return -EFAULT;
+ }
seg_i->next_segno = segno;
reset_curseg(sbi, i, 0);
seg_i->alloc_type = ckpt->alloc_type[i];
--
2.22.0.410.gd8fdbe21b5-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH v4] f2fs: avoid out-of-range memory access
2019-07-08 4:34 [f2fs-dev] [PATCH v4] f2fs: avoid out-of-range memory access Ocean Chen via Linux-f2fs-devel
@ 2019-07-08 6:30 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2019-07-08 6:30 UTC (permalink / raw)
To: Ocean Chen, jaegeuk, linux-f2fs-devel, linux-kernel
On 2019/7/8 12:34, Ocean Chen wrote:
> blkoff_off might over 512 due to fs corrupt or security
> vulnerability. That should be checked before being using.
>
> Use ENTRIES_IN_SUM to protect invalid value in cur_data_blkoff.
>
> Signed-off-by: Ocean Chen <oceanchen@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-08 6:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08 4:34 [f2fs-dev] [PATCH v4] f2fs: avoid out-of-range memory access Ocean Chen via Linux-f2fs-devel
2019-07-08 6:30 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).