From: Christoph Hellwig Date: Sat, 2 Jan 2010 11:12:19 +0000 (+0100) Subject: repair: fix freespace btree record validation X-Git-Tag: v3.1.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c83b756da0dac727457022d88d2a0ace30a6dc09;p=thirdparty%2Fxfsprogs-dev.git repair: fix freespace btree record validation MAXEXTLEN is a limit for the bmap btree extent length, not for the freespace btrees which can fill out the whole u32. Remove the check which makes repair skip too large freespace extents. Also add warnings for freespace btree records that fail the remaining validations. Signed-off-by: Christoph Hellwig Reviewed-by: Dave Chinner --- diff --git a/repair/scan.c b/repair/scan.c index 5f5743e63..742489438 100644 --- a/repair/scan.c +++ b/repair/scan.c @@ -520,12 +520,18 @@ _("%s freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"), len = be32_to_cpu(rp[i].ar_blockcount); end = b + len; - if (b == 0 || !verify_agbno(mp, agno, b)) - continue; - if (len == 0 || len > MAXEXTLEN) + if (b == 0 || !verify_agbno(mp, agno, b)) { + do_warn( + _("invalid start block %u in record %u of %d btree block %u/%u"), + b, i, name, agno, bno); continue; - if (!verify_agbno(mp, agno, end - 1)) + } + if (len == 0 || !verify_agbno(mp, agno, end - 1)) { + do_warn( + _("invalid length %u in record %u of %d btree block %u/%u"), + len, i, name, agno, bno); continue; + } for ( ; b < end; b += blen) { state = get_bmap_ext(agno, b, end, &blen);