From patchwork Thu Mar 31 13:23:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johann Lombardi X-Patchwork-Id: 679381 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 p2VDQGY1031464 for ; Thu, 31 Mar 2011 13:26:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757567Ab1CaNZ4 (ORCPT ); Thu, 31 Mar 2011 09:25:56 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:47389 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757558Ab1CaNZz (ORCPT ); Thu, 31 Mar 2011 09:25:55 -0400 Received: by wya21 with SMTP id 21so2016408wya.19 for ; Thu, 31 Mar 2011 06:25:53 -0700 (PDT) Received: by 10.216.181.199 with SMTP id l49mr2052302wem.68.1301577953781; Thu, 31 Mar 2011 06:25:53 -0700 (PDT) Received: from granier.localdomain (mon73-1-88-175-233-84.fbx.proxad.net [88.175.233.84]) by mx.google.com with ESMTPS id l24sm650810wbc.30.2011.03.31.06.25.52 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 31 Mar 2011 06:25:53 -0700 (PDT) Received: by granier.localdomain (Postfix, from userid 1001) id 812EA1571EF; Thu, 31 Mar 2011 15:25:49 +0200 (CEST) From: Johann Lombardi To: linux-btrfs@vger.kernel.org Cc: Johann Lombardi Subject: [PATCH] Btrfs: fix subvol_sem leak in btrfs_rename() Date: Thu, 31 Mar 2011 15:23:47 +0200 Message-Id: <1301577827-19380-1-git-send-email-johann@whamcloud.com> X-Mailer: git-send-email 1.7.1 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]); Thu, 31 Mar 2011 13:26:16 +0000 (UTC) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 93c28a1..495b055 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6960,8 +6960,10 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, * should cover the worst case number of items we'll modify. */ trans = btrfs_start_transaction(root, 20); - if (IS_ERR(trans)) - return PTR_ERR(trans); + if (IS_ERR(trans)) { + ret = PTR_ERR(trans); + goto out_notrans; + } btrfs_set_trans_block_group(trans, new_dir); @@ -7061,7 +7063,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, } out_fail: btrfs_end_transaction_throttle(trans, root); - +out_notrans: if (old_inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) up_read(&root->fs_info->subvol_sem);