[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200707010116.54884.jesper.juhl@gmail.com>
Date: Sun, 1 Jul 2007 01:16:54 +0200
From: Jesper Juhl <jesper.juhl@...il.com>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc: David Chinner <dgc@....com>, xfs-masters@....sgi.com,
xfs@....sgi.com, Andrew Morton <akpm@...ux-foundation.org>,
Jesper Juhl <jesper.juhl@...il.com>
Subject: [PATCH][XFS][resend] memory leak; allocated transaction not freed in xfs_inactive_free_eofblocks() in failure case.
(this is back from May 16 2007, resending since it doesn't look like
the patch ever made it in anywhere)
Fix XFS memory leak; allocated transaction not freed in xfs_inactive_free_eofblocks() in failure case.
the code allocates a transaction, but in the case where 'truncate' is
!=0 and xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE, 0); happens to return
an error, we'll just return from the function without dealing with the
memory allocated byxfs_trans_alloc() and assigned to 'tp', thus it'll be
orphaned/leaked - not good.
Signed-off-by: Jesper Juhl <jesper.juhl@...il.com>
---
fs/xfs/xfs_vnodeops.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index de17aed..32519cf 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1260,6 +1260,7 @@ xfs_inactive_free_eofblocks(
error = xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE,
ip->i_size);
if (error) {
+ xfs_trans_cancel(tp, 0);
xfs_iunlock(ip, XFS_IOLOCK_EXCL);
return error;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists