From patchwork Mon Apr 4 01:52:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsutomu Itoh X-Patchwork-Id: 684511 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p341rlrZ015554 for ; Mon, 4 Apr 2011 01:53:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753595Ab1DDBxd (ORCPT ); Sun, 3 Apr 2011 21:53:33 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:52714 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753582Ab1DDBxd (ORCPT ); Sun, 3 Apr 2011 21:53:33 -0400 Received: from m3.gw.fujitsu.co.jp (unknown [10.0.50.73]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id D525E3EE0BC for ; Mon, 4 Apr 2011 10:53:28 +0900 (JST) Received: from smail (m3 [127.0.0.1]) by outgoing.m3.gw.fujitsu.co.jp (Postfix) with ESMTP id BE27A45DE9A for ; Mon, 4 Apr 2011 10:53:28 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (s3.gw.fujitsu.co.jp [10.0.50.93]) by m3.gw.fujitsu.co.jp (Postfix) with ESMTP id A85C845DE98 for ; Mon, 4 Apr 2011 10:53:28 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id 9BF32E08003 for ; Mon, 4 Apr 2011 10:53:28 +0900 (JST) Received: from m107.s.css.fujitsu.com (m107.s.css.fujitsu.com [10.240.81.147]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id 678FBE08001 for ; Mon, 4 Apr 2011 10:53:28 +0900 (JST) Received: from m107.css.fujitsu.com (m107 [127.0.0.1]) by m107.s.css.fujitsu.com (Postfix) with ESMTP id DC304860010; Mon, 4 Apr 2011 10:53:27 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.101.84]) by m107.s.css.fujitsu.com (Postfix) with ESMTP id BDD76680009; Mon, 4 Apr 2011 10:53:23 +0900 (JST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.4.0 Received: from T-ITOH1[10.124.101.84] by T-ITOH1 (FujitsuOutboundMailChecker v1.4.0/9992[10.124.101.84]); Mon, 04 Apr 2011 10:52:19 +0900 (JST) Message-ID: <4D99244D.5050704@jp.fujitsu.com> Date: Mon, 04 Apr 2011 10:52:13 +0900 From: Tsutomu Itoh User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: Linux Btrfs CC: Chris Mason Subject: Re: [PATCH] Btrfs: fix memory leak in btrfs_ioctl_start_sync() References: <4D991A3B.9020805@jp.fujitsu.com> In-Reply-To: <4D991A3B.9020805@jp.fujitsu.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 04 Apr 2011 01:53:48 +0000 (UTC) Sorry. Ignore previous patch. New patch is as follows. Thanks, Tsutomu (2011/04/04 10:09), Tsutomu Itoh wrote: > Free btrfs_trans_handle if btrfs_commit_transaction_async() fails. > > Signed-off-by: Tsutomu Itoh > --- > fs/btrfs/ioctl.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff -urNp linux-2.6.39-rc1/fs/btrfs/ioctl.c linux-2.6.39-rc1.new/fs/btrfs/ioctl.c > --- linux-2.6.39-rc1/fs/btrfs/ioctl.c 2011-03-30 04:09:47.000000000 +0900 > +++ linux-2.6.39-rc1.new/fs/btrfs/ioctl.c 2011-04-04 09:52:17.000000000 +0900 > @@ -2436,8 +2436,10 @@ static noinline long btrfs_ioctl_start_s > return PTR_ERR(trans); > transid = trans->transid; > ret = btrfs_commit_transaction_async(trans, root, 0); > - if (ret) > + if (ret) { > + kmem_cache_free(btrfs_trans_handle_cachep, trans); > return ret; > + } > > if (argp) > if (copy_to_user(argp, &transid, sizeof(transid))) > Call btrfs_end_transaction() if btrfs_commit_transaction_async() fails. Signed-off-by: Tsutomu Itoh --- fs/btrfs/ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -urNp linux-2.6.39-rc1/fs/btrfs/ioctl.c linux-2.6.39-rc1.new/fs/btrfs/ioctl.c --- linux-2.6.39-rc1/fs/btrfs/ioctl.c 2011-03-30 04:09:47.000000000 +0900 +++ linux-2.6.39-rc1.new/fs/btrfs/ioctl.c 2011-04-04 10:46:45.000000000 +0900 @@ -2436,8 +2436,10 @@ static noinline long btrfs_ioctl_start_s return PTR_ERR(trans); transid = trans->transid; ret = btrfs_commit_transaction_async(trans, root, 0); - if (ret) + if (ret) { + btrfs_end_transaction(trans, root); return ret; + } if (argp) if (copy_to_user(argp, &transid, sizeof(transid)))