Skip to contentSkip to conversation

f2fs-tools: sanity check blk_off for summary block entries

PATCH New Jin Qian 1 participant 1 message Apr 27, 2017

lore
Share & tools
lore

Jin Qian

author
#0 lore raw

PATCH 1/1 f2fs-tools: sanity check blk_off for summary block entries

crafted malicious f2fs partition can fill an out of bound blk_off, which cause overflow when accessing summary block entries.

---
 fsck/mount.c | 2 ++
 1 file changed, 2 insertions(+)
fsck/mount.c +2 -0
index 761baa0..0a63b71 100644
@@ -889,6 +889,8 @@ static void read_compacted_summaries(struct f2fs_sb_info *sbi)
 		else
 			blk_off = curseg->next_blkoff;
 
+		ASSERT(blk_off <= ENTRIES_IN_SUM);
+
 		for (j = 0; j < blk_off; j++) {
 			struct f2fs_summary *s;
 			s = (struct f2fs_summary *)(kaddr + offset);
Signature · 6 lines
2.13.0.rc0.306.g87b477812d-goog


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot