From patchwork Mon Apr 4 01:09:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsutomu Itoh X-Patchwork-Id: 684501 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 p341B2Tk028010 for ; Mon, 4 Apr 2011 01:11:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753391Ab1DDBKs (ORCPT ); Sun, 3 Apr 2011 21:10:48 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:40886 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753042Ab1DDBKr (ORCPT ); Sun, 3 Apr 2011 21:10:47 -0400 Received: from m1.gw.fujitsu.co.jp (unknown [10.0.50.71]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id 480CD3EE0AE for ; Mon, 4 Apr 2011 10:10:44 +0900 (JST) Received: from smail (m1 [127.0.0.1]) by outgoing.m1.gw.fujitsu.co.jp (Postfix) with ESMTP id 2DEDC45DE55 for ; Mon, 4 Apr 2011 10:10:44 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (s1.gw.fujitsu.co.jp [10.0.50.91]) by m1.gw.fujitsu.co.jp (Postfix) with ESMTP id 1516C45DE58 for ; Mon, 4 Apr 2011 10:10:44 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id 05D21E38003 for ; Mon, 4 Apr 2011 10:10:44 +0900 (JST) Received: from m106.s.css.fujitsu.com (m106.s.css.fujitsu.com [10.240.81.146]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id C7912E08003 for ; Mon, 4 Apr 2011 10:10:43 +0900 (JST) Received: from m106.css.fujitsu.com (m106 [127.0.0.1]) by m106.s.css.fujitsu.com (Postfix) with ESMTP id 9BC4A5B91BD; Mon, 4 Apr 2011 10:10:43 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.101.84]) by m106.s.css.fujitsu.com (Postfix) with ESMTP id 329335B90BF; Mon, 4 Apr 2011 10:10:43 +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:09:37 +0900 (JST) Message-ID: <4D991A3B.9020805@jp.fujitsu.com> Date: Mon, 04 Apr 2011 10:09:15 +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: [PATCH] Btrfs: fix memory leak in btrfs_ioctl_start_sync() 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:11:03 +0000 (UTC) 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(-) -- 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 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)))