From 67a79e2cc9320aaf269cd00e9c8d16892931886d Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Wed, 23 May 2018 16:30:48 -0500 Subject: [PATCH] xfs_repair: treat zero da btree pointers as corruption If a da btree pointer is zero (i.e. the beginning of the fork) report this as a corrupt tree to the caller instead of telling it that everything is good. Fixes assertion errors when fuzzing nbtree[0].before to zero in xfs/394. [sandeen: tweak comment above change for clarity] Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- repair/dir2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/repair/dir2.c b/repair/dir2.c index 73dff902e..94dd649b0 100644 --- a/repair/dir2.c +++ b/repair/dir2.c @@ -1235,11 +1235,11 @@ process_node_dir2( return 1; /* - * Skip directories with a root marked XFS_DIR2_LEAFN_MAGIC + * Directories with a root marked XFS_DIR2_LEAFN_MAGIC are corrupt */ if (bno == 0) { - release_da_cursor(mp, &da_cursor, 0); - return 0; + err_release_da_cursor(mp, &da_cursor, 0); + return 1; } else { /* * Now pass cursor and bno into leaf-block processing routine. -- 2.39.2