From patchwork Sat Mar 8 00:11:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 328127 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 28F822C00A3 for ; Sat, 8 Mar 2014 11:12:14 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WM4rs-0001hu-DI; Sat, 08 Mar 2014 00:11:56 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WM4rq-00025t-Pe; Sat, 08 Mar 2014 00:11:54 +0000 Received: from mail-gw1-out.broadcom.com ([216.31.210.62]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WM4rn-00025P-Pb for linux-mtd@lists.infradead.org; Sat, 08 Mar 2014 00:11:52 +0000 X-IronPort-AV: E=Sophos;i="4.97,611,1389772800"; d="scan'208";a="18608992" Received: from irvexchcas08.broadcom.com (HELO IRVEXCHCAS08.corp.ad.broadcom.com) ([10.9.208.57]) by mail-gw1-out.broadcom.com with ESMTP; 07 Mar 2014 16:53:59 -0800 Received: from IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.3.174.1; Fri, 7 Mar 2014 16:11:29 -0800 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) with Microsoft SMTP Server id 14.3.174.1; Fri, 7 Mar 2014 16:11:29 -0800 Received: from fainelli-desktop.broadcom.com (unknown [10.12.164.252]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 61100EAD4B; Fri, 7 Mar 2014 16:11:29 -0800 (PST) From: Florian Fainelli To: Subject: [PATCH] UBIFS: add missing znode freeing in tcn_insert() Date: Fri, 7 Mar 2014 16:11:27 -0800 Message-ID: <1394237487-2728-1-git-send-email-f.fainelli@gmail.com> X-Mailer: git-send-email 1.8.3.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140307_191151_919728_B3B28E00 X-CRM114-Status: UNSURE ( 7.40 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.3 (/) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (f.fainelli[at]gmail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list Cc: Florian Fainelli , computersforpeace@gmail.com, linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In case the zi allocation fails in the do_split label, we will fail freeing zn that we allocated before, add a missing kfree. Signed-off-by: Florian Fainelli --- fs/ubifs/tnc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index 9083bc7ed4ae..9b84d91ea530 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c @@ -2105,8 +2105,10 @@ do_split: dbg_tnc("creating new zroot at level %d", znode->level + 1); zi = kzalloc(c->max_znode_sz, GFP_NOFS); - if (!zi) + if (!zi) { + kfree(zn); return -ENOMEM; + } zi->child_cnt = 2; zi->level = znode->level + 1;