Re: [PATCH 08/13] xfs_repair: catch bad level/depth in da node

Brian Foster
2015-09-14T19:44:10Z

On Wed, Sep 09, 2015 at 02:34:06PM -0500, Eric Sandeen wrote:
> Two tests added some time ago to dir2.c:
>
> 44dae5e xfs_repair: test for bad level in dir2 node
> 28148f6 xfs_repair: catch bad depth in traverse_int_dir2block
>
> never made it to the similar tree-walking code in attr_repair.c;
> fix that up here. The error string details will be fixed up
> later.
>
> Signed-off-by; Eric Sandeen <sandeen@redhat.com>
>
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

> repair/attr_repair.c | 12 ++++++++++--
> 1 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/repair/attr_repair.c b/repair/attr_repair.c
> index 5ae2356..2aafdf6 100644
> --- a/repair/attr_repair.c
> +++ b/repair/attr_repair.c
> @@ -212,9 +212,17 @@ traverse_int_dablock(xfs_mount_t *mp,
> /*
> * maintain level counter
> */
> - if (i == -1)
> + if (i == -1) {
> i = da_cursor->active = nodehdr.level;
> - else {
> + if (i < 1 || i >= XFS_DA_NODE_MAXDEPTH) {
> + do_warn(
> +_("bad header depth for directory inode %" PRIu64 "\n"),
> + da_cursor->ino);
> + libxfs_putbuf(bp);
> + i = -1;
> + goto error_out;
> + }
> + } else {
> if (nodehdr.level == i - 1) {
> i--;
> } else {
> --
> 1.7.1
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs