From: Eric Sandeen <sandeen@sandeen.net>
To: xfs-oss <xfs@oss.sgi.com>, Jesse Stroik <jstroik@ssec.wisc.edu>
Subject: Re: [PATCH] xfs_repair: fix verify_ag_bno() overflow
Date: Wed, 01 Jul 2009 17:15:33 -0500 [thread overview]
Message-ID: <4A4BE005.3000102@sandeen.net> (raw)
In-Reply-To: <4A4BC7FF.6050004@sandeen.net>
Argh self-nak on that one, stupid thinko; it always returns
1 for a non-last AG :/ Just add the cast and don't get fancy!
V2 below:
-------
The last test in verify_ag_bno() may overflow:
return (agbno >= (sbp->sb_dblocks -
((sbp->sb_agcount - 1) * sbp->sb_agblocks)));
because sb_agcount & sb_agblocks are 32-bit integers; this
may then miss corrupt agbnos for the last ag, which can in
turn lead to out of bounds memory accesses later, for example
when the block nr is used to offset in set_agbno_state():
addr = ba_bmap[(agno)] + (ag_blockno)/XR_BB_NUM;
Reported-by: Jesse Stroik <jstroik@ssec.wisc.edu>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
diff --git a/repair/dinode.c b/repair/dinode.c
index fdf52db..84e1d05 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -319,7 +319,8 @@ verify_ag_bno(xfs_sb_t *sbp,
return (agbno >= sbp->sb_agblocks);
if (agno == (sbp->sb_agcount - 1))
return (agbno >= (sbp->sb_dblocks -
- ((sbp->sb_agcount - 1) * sbp->sb_agblocks)));
+ ((xfs_drfsbno_t)(sbp->sb_agcount - 1) *
+ sbp->sb_agblocks)));
return 1;
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2009-07-01 22:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-01 20:33 [PATCH] xfs_repair: fix verify_ag_bno() overflow Eric Sandeen
2009-07-01 22:15 ` Eric Sandeen [this message]
2009-07-02 4:13 ` [PATCH V3] xfs_repair: fix agcount*agblocks overflows Eric Sandeen
2009-07-02 5:24 ` Felix Blyakher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A4BE005.3000102@sandeen.net \
--to=sandeen@sandeen.net \
--cc=jstroik@ssec.wisc.edu \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox