[PATCH 01/11] xfs_repair: set args.geo in dir2_kill_block

Darrick J. Wong
2015-08-26T00:32:34Z

Frøm: Eric Sandeen <sandeen@sandeen.net>

This path in xfs_repair:

dir2_kill_block
libxfs_da_shrink_inode
xfs_dir2_shrink_inode
xfs_dir2_db_to_da

segfaults, because dir2_kill_block() does not initialize
args.geo, and a null geometry winds up in xfs_dir2_db_to_da(),
which dereferences it.

Fix that.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
repair/phase6.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/repair/phase6.c b/repair/phase6.c
index 04638c2..7e275cd 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -1444,6 +1444,7 @@ dir2_kill_block(
args.firstblock = &firstblock;
args.flist = &flist;
args.whichfork = XFS_DATA_FORK;
+ args.geo = mp->m_dir_geo;
if (da_bno >= mp->m_dir_geo->leafblk && da_bno < mp->m_dir_geo->freeblk)
error = -libxfs_da_shrink_inode(&args, da_bno, bp);
else