* [f2fs-dev] [PATCH] f2fs: avoid out-of-range memory access
@ 2019-07-02 7:15 Ocean Chen via Linux-f2fs-devel
0 siblings, 0 replies; only message in thread
From: Ocean Chen via Linux-f2fs-devel @ 2019-07-02 7:15 UTC (permalink / raw)
To: jaegeuk, yuchao0, linux-f2fs-devel, linux-kernel; +Cc: oceanchen
blk_off might over 512 due to fs corrupt.
Use ENTRIES_IN_SUM to protect invalid memory access.
Signed-off-by: Ocean Chen <oceanchen@google.com>
---
fs/f2fs/segment.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 8dee063c833f..b83c23ebae1f 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3403,6 +3403,8 @@ static int read_compacted_summaries(struct f2fs_sb_info *sbi)
for (j = 0; j < blk_off; j++) {
struct f2fs_summary *s;
+ if (blk_off >= ENTRIES_IN_SUM)
+ return -EFAULT;
s = (struct f2fs_summary *)(kaddr + offset);
seg_i->sum_blk->entries[j] = *s;
offset += SUMMARY_SIZE;
--
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] only message in thread
only message in thread, other threads:[~2019-07-02 7:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-02 7:15 [f2fs-dev] [PATCH] f2fs: avoid out-of-range memory access Ocean Chen via Linux-f2fs-devel
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).