diff options
author | Jin Qian <jinqian@google.com> | 2017-04-25 16:25:11 -0700 |
---|---|---|
committer | Jin Qian <jinqian@google.com> | 2017-05-08 14:08:45 -0700 |
commit | 1a59456653beccf08281281c32abfa4fff785f73 (patch) | |
tree | 9865c68fb47e0696e6007f1cbffbc3ae4857d6e6 | |
parent | 3a3c6c2eb7e69acbb99a351e20a621cde956f9c5 (diff) | |
download | f2fs-tools-1a59456653beccf08281281c32abfa4fff785f73.tar.gz |
f2fs-tools: sanity check segment count
make sure segment count in super block doesn't exceed F2FS_MAX_SEGMENT.
Bug: 36392513
Bug: 36815012
Change-Id: I0f699f58fb6bab27008a7ab956a87fe241bb0169
Signed-off-by: Jin Qian <jinqian@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fsck/mount.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fsck/mount.c b/fsck/mount.c index 761baa0..0111960 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -406,6 +406,9 @@ int sanity_check_raw_super(struct f2fs_super_block *sb, u64 offset) return -1; } + if (get_sb(segment_count) > F2FS_MAX_SEGMENT) + return -1; + if (sanity_check_area_boundary(sb, offset)) return -1; return 0; |