xfs
[Top] [All Lists]

[PATCH][XFS][resend] memory leak; allocated transaction not freed in xfs

To: Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH][XFS][resend] memory leak; allocated transaction not freed in xfs_inactive_free_eofblocks() in failure case.
From: Jesper Juhl <jesper.juhl@xxxxxxxxx>
Date: Sun, 1 Jul 2007 01:16:54 +0200
Cc: David Chinner <dgc@xxxxxxx>, xfs-masters@xxxxxxxxxxx, xfs@xxxxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Jesper Juhl <jesper.juhl@xxxxxxxxx>
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:from:to:subject:date:user-agent:cc:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=nUvBprw7jkreXNtBphsVddcPhv5TaHF1vvmC7eYAPb/A0Vhm1abXlEbwuXdAJ8sseRGFeIHfrlqUmx3Iv8Rhzt3ihfeDsB34absTNhHxpjNTgsq+lcoF1Sm3nZa3xh3ko5Tspt+7LSlJyxXzZHYpjSbFvdF5Ax8YcSa8ANe33wM=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:to:subject:date:user-agent:cc:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=I4vjL3UrTV7ojORIi3wpSahMchvw3nuWo4Ju1Tp1UKeO0kRnk6Kg2QY9V2RBG4eXFh0NtZrSCeF43Fn/U8M+vsWx2fmOWyKhlZO+G5J1F8JQuEV57nSmK8p9AGEv7Mlpl6gyEbapMb+z12jSY1adzdz8G7rDohmGMf89nFCWnMU=
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: KMail/1.9.7
(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@xxxxxxxxx>
--- 
 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;
                }



<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH][XFS][resend] memory leak; allocated transaction not freed in xfs_inactive_free_eofblocks() in failure case., Jesper Juhl <=