From: Mark Tinguely <tinguely@sgi.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: "'linux-xfs@oss.sgi.com'" <linux-xfs@oss.sgi.com>
Subject: Re: [PATCH V3] xfs_repair: test for bad level in dir2 node
Date: Thu, 12 Sep 2013 16:17:42 -0500 [thread overview]
Message-ID: <52322F76.4080306@sgi.com> (raw)
In-Reply-To: <52322A84.1030007@sandeen.net>
On 09/12/13 15:56, Eric Sandeen wrote:
> In traverse_int_dir2block(), the variable 'i' is the level in
> the tree, with 0 being a leaf node. In the "do" loop we
> start at the root, and work our way down to a leaf.
>
> If the first node we read is an interior node with NODE_MAGIC,
> but it tells us that its level is 0 (a leaf), this is clearly
> an inconsistency.
>
> Worse, we'd return with success, bno set, and only level[0]
> in the cursor initialized. Then down this path we'll
> segfault when accessing an uninitialized (and zeroed) member
> of the cursor's level array:
>
> process_node_dir2
> traverse_int_dir2block // returns 0 w/ bno set, only level[0] init'd
> process_leaf_level_dir2
> verify_dir2_path(mp, da_cursor, 0) // p_level == 0
> this_level = p_level + 1;
> node = cursor->level[this_level].bp->b_addr; // level[1] uninit& 0'd
>
> Fix this by recognizing that an interior node w/ level 0 is invalid, and
> error out as for other inconsistencies.
>
> By the time the level 0 test is done, we have already ensured that
> this block has XFS_DA[3]_NODE_MAGIC.
>
> Reported-by: Jan Yves Brueckner<jyb@gmx.com>
> Signed-off-by: Eric Sandeen<sandeen@redhat.com>
> ---
>
> V3: Simplify the test.
>
> Mark, Dave, I know you had some concerns about other conditions being
> tested, but I think those are separate from this fix, which simply ensures
> that the level we find for this _NODE block is within the valid range
> for a node. (It also matches the test currently present in xfs_check).
>
Nod.
--Mark.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-09-12 21:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-04 15:19 [PATCH] xfs_repair: test for bad level in dir2 node Eric Sandeen
2013-09-10 0:45 ` Dave Chinner
2013-09-10 15:46 ` Eric Sandeen
2013-09-10 15:51 ` [PATCH V2] " Eric Sandeen
2013-09-10 16:43 ` Mark Tinguely
2013-09-10 17:24 ` Eric Sandeen
2013-09-10 18:03 ` Mark Tinguely
2013-09-11 2:27 ` Eric Sandeen
2013-09-12 20:56 ` [PATCH V3] " Eric Sandeen
2013-09-12 21:17 ` Mark Tinguely [this message]
2013-09-18 18:48 ` Mark Tinguely
2013-10-18 17:51 ` Rich Johnston
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=52322F76.4080306@sgi.com \
--to=tinguely@sgi.com \
--cc=linux-xfs@oss.sgi.com \
--cc=sandeen@sandeen.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.