From patchwork Tue May 16 23:58:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyunchul Lee X-Patchwork-Id: 763232 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wSDxK73lvz9s06 for ; Wed, 17 May 2017 10:01:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="S5e+S0BJ"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=CVEv7wQ1AtXUZb1+xRlMJ3KncXh0hp1Z+M/k0sa83no=; b=S5e+S0BJZcoXc2 8MOZcPplxKN4xKXOO48mTs9JAiaV7FA88Qlb6awu0Pgibh3CdfxXZ6oZ1IHLf5Xh5WjBPU0jp1Uow 9oZ7SSjCjHTuU3o0Ze+A135OkjO34Fy9U50mg+tlrd+IGpglovTFju0Z++0nbW872QViL2IQff1st Df+ZNXvOuxvsn8q+TnRtf72cNM+FM9xP3mB3+hBzVnZCtkslZ5zPEm9U7u/NaOR5V34Cw8tuNSUoU 2bJKIZx+ZbAil6P+qyUtk4StgC58UoXMPnqe7UDB7v3CalF+bfzjuVEAjGn8YhG6IytkwkpMA7sOe DfpzLN56fIGfmYIEqTVg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dAmOo-0006wD-Vj; Wed, 17 May 2017 00:01:07 +0000 Received: from lgeamrelo12.lge.com ([156.147.23.52]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dAmOj-0006rF-Sf for linux-mtd@lists.infradead.org; Wed, 17 May 2017 00:01:04 +0000 Received: from unknown (HELO lgeamrelo04.lge.com) (156.147.1.127) by 156.147.23.52 with ESMTP; 17 May 2017 09:00:39 +0900 X-Original-SENDERIP: 156.147.1.127 X-Original-MAILFROM: cheol.lee@lge.com Received: from unknown (HELO LGEAEXHB03P.LGE.NET) (165.244.249.23) by 156.147.1.127 with ESMTP; 17 May 2017 08:58:05 +0900 X-Original-SENDERIP: 165.244.249.23 X-Original-MAILFROM: cheol.lee@lge.com Received: from lgekrmhub04.lge.com (10.185.110.14) by LGEAEXHB03P.LGE.NET (165.244.249.23) with Microsoft SMTP Server id 8.3.264.0; Wed, 17 May 2017 08:58:04 +0900 Received: from lgeamrelo01.lge.com ([156.147.1.125]) by lgekrmhub04.lge.com (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017051708580389-2846988 ; Wed, 17 May 2017 08:58:03 +0900 Received: from unknown (HELO localhost.localdomain) (10.177.225.40) by 156.147.1.125 with ESMTP; 17 May 2017 08:58:04 +0900 X-Original-SENDERIP: 10.177.225.40 X-Original-MAILFROM: cheol.lee@lge.com From: Hyunchul Lee To: Richard Weinberger Subject: [PATCH 2/2] ubifs: Fix memory leak in RENAME_WHITEOUT error path in do_rename Date: Wed, 17 May 2017 08:58:02 +0900 Message-ID: <1494979082-19414-1-git-send-email-cheol.lee@lge.com> X-Mailer: git-send-email 1.9.1 X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB04/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2017/05/17 08:58:04, Serialize by Router on LGEKRMHUB04/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2017/05/17 08:58:04, Serialize complete at 2017/05/17 08:58:04 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170516_170102_286222_80BABDDC X-CRM114-Status: UNSURE ( 8.12 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [156.147.23.52 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [156.147.23.52 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Artem Bityutskiy , linux-kernel@vger.kernel.org, adrian.hunter@intel.com, kernel-team@lge.com, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org in RENAME_WHITEOUT error path, fscrypt_name should be freed. Signed-off-by: Hyunchul Lee --- fs/ubifs/dir.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index df67236..0d5f8e7 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -1385,17 +1385,14 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, dev = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS); if (!dev) { - ubifs_release_budget(c, &req); - ubifs_release_budget(c, &ino_req); - return -ENOMEM; + err = -ENOMEM; + goto out_release; } err = do_tmpfile(old_dir, old_dentry, S_IFCHR | WHITEOUT_MODE, &whiteout); if (err) { - ubifs_release_budget(c, &req); - ubifs_release_budget(c, &ino_req); kfree(dev); - return err; + goto out_release; } whiteout->i_state |= I_LINKABLE; @@ -1483,12 +1480,10 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, err = ubifs_budget_space(c, &wht_req); if (err) { - ubifs_release_budget(c, &req); - ubifs_release_budget(c, &ino_req); kfree(whiteout_ui->data); whiteout_ui->data_len = 0; iput(whiteout); - return err; + goto out_release; } inc_nlink(whiteout); @@ -1543,6 +1538,7 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, iput(whiteout); } unlock_4_inodes(old_dir, new_dir, new_inode, whiteout); +out_release: ubifs_release_budget(c, &ino_req); ubifs_release_budget(c, &req); fscrypt_free_filename(&old_nm);