Received: with ECARTIS (v1.0.0; list xfs); Sat, 30 Jun 2007 16:46:07 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.2.0-pre1-r499012 (2007-01-23) on oss.sgi.com X-Spam-Level: *** X-Spam-Status: No, score=3.0 required=5.0 tests=AWL,BAYES_99 autolearn=no version=3.2.0-pre1-r499012 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l5UNk0tL031451 for ; Sat, 30 Jun 2007 16:46:03 -0700 Received: by ug-out-1314.google.com with SMTP id z36so1202865uge for ; Sat, 30 Jun 2007 16:46:02 -0700 (PDT) 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= Received: by 10.67.88.20 with SMTP id q20mr1488894ugl.1183245479355; Sat, 30 Jun 2007 16:17:59 -0700 (PDT) Received: from ?192.168.1.34? ( [90.184.90.115]) by mx.google.com with ESMTP id 61sm2475024ugz.2007.06.30.16.17.58 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 30 Jun 2007 16:17:58 -0700 (PDT) From: Jesper Juhl To: Linux Kernel Mailing List Subject: [PATCH][XFS][resend] memory leak; allocated transaction not freed in xfs_inactive_free_eofblocks() in failure case. Date: Sun, 1 Jul 2007 01:16:54 +0200 User-Agent: KMail/1.9.7 Cc: David Chinner , xfs-masters@oss.sgi.com, xfs@oss.sgi.com, Andrew Morton , Jesper Juhl MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200707010116.54884.jesper.juhl@gmail.com> X-Virus-Scanned: ClamAV version 0.90, clamav-milter version devel-120207 on oss.sgi.com X-Virus-Status: Clean X-archive-position: 12056 X-ecartis-version: Ecartis v1.0.0 Sender: xfs-bounce@oss.sgi.com Errors-to: xfs-bounce@oss.sgi.com X-original-sender: jesper.juhl@gmail.com Precedence: bulk X-list: xfs (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 --- 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; }