public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_repair: set args.geo in dir2_kill_block
@ 2015-07-23 20:14 Eric Sandeen
  2015-07-26 16:24 ` Christoph Hellwig
  2015-08-25 16:55 ` Eric Sandeen
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2015-07-23 20:14 UTC (permalink / raw)
  To: xfs-oss

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>
---

diff --git a/repair/phase6.c b/repair/phase6.c
index de445c6..0c952ed 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -1438,6 +1438,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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_repair: set args.geo in dir2_kill_block
  2015-07-23 20:14 [PATCH] xfs_repair: set args.geo in dir2_kill_block Eric Sandeen
@ 2015-07-26 16:24 ` Christoph Hellwig
  2015-08-25 16:55 ` Eric Sandeen
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2015-07-26 16:24 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

And I have to say the API where we need to initialize this non-obvious
pointer in the da_args structure rally sucks :(

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_repair: set args.geo in dir2_kill_block
  2015-07-23 20:14 [PATCH] xfs_repair: set args.geo in dir2_kill_block Eric Sandeen
  2015-07-26 16:24 ` Christoph Hellwig
@ 2015-08-25 16:55 ` Eric Sandeen
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2015-08-25 16:55 UTC (permalink / raw)
  To: xfs-oss

Dave, ping on this?

Thanks,
-Eric

On 7/23/15 3:14 PM, Eric Sandeen wrote:
> 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>
> ---
> 
> diff --git a/repair/phase6.c b/repair/phase6.c
> index de445c6..0c952ed 100644
> --- a/repair/phase6.c
> +++ b/repair/phase6.c
> @@ -1438,6 +1438,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
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-25 16:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-23 20:14 [PATCH] xfs_repair: set args.geo in dir2_kill_block Eric Sandeen
2015-07-26 16:24 ` Christoph Hellwig
2015-08-25 16:55 ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox