|
|
252946 |
From 2ab3543e3b3330317769adcbe4bdb2f3c0b855e9 Mon Sep 17 00:00:00 2001
|
|
|
252946 |
From: "Darrick J. Wong" <darrick.wong@oracle.com>
|
|
|
252946 |
Date: Thu, 24 Jul 2014 22:19:27 -0400
|
|
|
252946 |
Subject: [PATCH 14/16] e2fsck: fix off-by-one bounds check on group number
|
|
|
252946 |
|
|
|
252946 |
commit b4f724c8a90987d4785fd1accfe69c125567be39
|
|
|
252946 |
|
|
|
252946 |
Since fs->group_desc_count is the number of block groups, the number
|
|
|
252946 |
of the last group is always one less than this count. Fix the bounds
|
|
|
252946 |
check to reflect that.
|
|
|
252946 |
|
|
|
252946 |
This flaw shouldn't have any user-visible side effects, since the
|
|
|
252946 |
block bitmap test based on last_grp later on can handle overbig block
|
|
|
252946 |
numbers.
|
|
|
252946 |
|
|
|
252946 |
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
|
|
|
252946 |
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
|
|
252946 |
---
|
|
|
252946 |
e2fsck/pass1.c | 4 ++--
|
|
|
252946 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
252946 |
|
|
|
252946 |
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
|
|
|
252946 |
index 71b3000a..b58a0ca7 100644
|
|
|
252946 |
--- a/e2fsck/pass1.c
|
|
|
252946 |
+++ b/e2fsck/pass1.c
|
|
|
252946 |
@@ -2599,8 +2599,8 @@ static void new_table_block(e2fsck_t ctx, blk64_t first_block, dgrp_t group,
|
|
|
252946 |
first_block = ext2fs_group_first_block2(fs,
|
|
|
252946 |
flexbg_size * flexbg);
|
|
|
252946 |
last_grp = group | (flexbg_size - 1);
|
|
|
252946 |
- if (last_grp > fs->group_desc_count)
|
|
|
252946 |
- last_grp = fs->group_desc_count;
|
|
|
252946 |
+ if (last_grp >= fs->group_desc_count)
|
|
|
252946 |
+ last_grp = fs->group_desc_count - 1;
|
|
|
252946 |
last_block = ext2fs_group_last_block2(fs, last_grp);
|
|
|
252946 |
} else
|
|
|
252946 |
last_block = ext2fs_group_last_block2(fs, group);
|
|
|
252946 |
--
|
|
|
252946 |
2.20.1
|
|
|
252946 |
|