[Ocfs2-tools-devel] [PATCH] Change local variable datatype to avoid infinite loop
Goldwyn Rodrigues
rgoldwyn at gmail.com
Mon Jul 26 13:19:25 PDT 2010
fsck on large filesystems goes in an infinite loop.
The problem is in verify_bitmap_descs(). i, a local variable is
declared as uint16_t and is compared with
ocfs2_cluster_group_sizes.cgs_cluster_groups which is uint32_t.
When cgs_cluster_groups is greater than 65535, i overflows and wraps
creating an infinite loop of the following:
for (i = 0, blkno = ost->ost_fs->fs_first_cg_blkno;
i < cgs.cgs_cluster_groups;
i++, blkno = i * ocfs2_clusters_to_blocks(ost->ost_fs,
cgs.cgs_cpg)) {
Signed-off-by: Goldwyn Rodrigues <rgoldwyn at suse.de>
Signed-off-by: Mark Fasheh <mfasheh at suse.com>
---
fsck.ocfs2/pass0.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: ocfs2-tools/fsck.ocfs2/pass0.c
===================================================================
--- ocfs2-tools.orig/fsck.ocfs2/pass0.c 2009-05-07 03:41:24.000000000 +0200
+++ ocfs2-tools/fsck.ocfs2/pass0.c 2010-07-26 19:16:26.000000000 +0200
@@ -849,7 +849,7 @@ static errcode_t verify_bitmap_descs(o2f
char *buf1, char *buf2)
{
struct ocfs2_cluster_group_sizes cgs;
- uint16_t i, max_recs;
+ uint16_t max_recs;
uint16_t bits, chain;
uint64_t blkno;
struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *)buf1;
@@ -857,7 +857,7 @@ static errcode_t verify_bitmap_descs(o2f
struct chain_state cs;
struct ocfs2_chain_rec *rec;
ocfs2_bitmap *allowed = NULL, *forbidden = NULL;
- int was_set;
+ int was_set, i;
/* XXX ugh, only used by mark_ */
cs.cs_cpg = di->id2.i_chain.cl_cpg;
More information about the Ocfs2-tools-devel
mailing list