public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* REVIEW: Zero uninitialised xfs_da_args structure in xfs_dir2.c
@ 2008-06-02  5:42 Barry Naujok
  2008-06-02  5:50 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Barry Naujok @ 2008-06-02  5:42 UTC (permalink / raw)
  To: xfs@oss.sgi.com

In particular, this patch fixes a problem in the xfs_dir2_remove and
xfs_dir2_replace paths which internally can call a lookup function
which will use args->cmpresult which is uninitialised.

--

Index: 2.6.x-xfs/fs/xfs/xfs_dir2.c
===================================================================
--- 2.6.x-xfs.orig/fs/xfs/xfs_dir2.c
+++ 2.6.x-xfs/fs/xfs/xfs_dir2.c
@@ -213,6 +213,7 @@ xfs_dir_createname(
  	if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum)))
  		return rval;
  	XFS_STATS_INC(xs_dir_create);
+	memset(&args, 0, sizeof(xfs_da_args_t));

  	args.name = name->name;
  	args.namelen = name->len;
@@ -297,7 +298,6 @@ xfs_dir_lookup(
  	args.op_flags = XFS_DA_OP_OKNOENT;
  	if (ci_name)
  		args.op_flags |= XFS_DA_OP_CILOOKUP;
-	args.cmpresult = XFS_CMP_DIFFERENT;

  	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
  		rval = xfs_dir2_sf_lookup(&args);
@@ -342,6 +342,7 @@ xfs_dir_removename(

  	ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
  	XFS_STATS_INC(xs_dir_remove);
+	memset(&args, 0, sizeof(xfs_da_args_t));

  	args.name = name->name;
  	args.namelen = name->len;
@@ -353,7 +354,6 @@ xfs_dir_removename(
  	args.total = total;
  	args.whichfork = XFS_DATA_FORK;
  	args.trans = tp;
-	args.op_flags = 0;

  	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
  		rval = xfs_dir2_sf_removename(&args);
@@ -425,6 +425,7 @@ xfs_dir_replace(

  	if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum)))
  		return rval;
+	memset(&args, 0, sizeof(xfs_da_args_t));

  	args.name = name->name;
  	args.namelen = name->len;
@@ -436,7 +437,6 @@ xfs_dir_replace(
  	args.total = total;
  	args.whichfork = XFS_DATA_FORK;
  	args.trans = tp;
-	args.op_flags = 0;

  	if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
  		rval = xfs_dir2_sf_replace(&args);

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

end of thread, other threads:[~2008-06-02  6:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-02  5:42 REVIEW: Zero uninitialised xfs_da_args structure in xfs_dir2.c Barry Naujok
2008-06-02  5:50 ` Christoph Hellwig
2008-06-02  6:08   ` Barry Naujok
2008-06-02  6:08     ` Christoph Hellwig

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