From patchwork Fri Jun 7 02:17:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 249579 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 DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4B8612C009A for ; Fri, 7 Jun 2013 12:18:02 +1000 (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 1UkmFP-0002eH-Ez; Fri, 07 Jun 2013 02:17:47 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UkmFN-0008It-6l; Fri, 07 Jun 2013 02:17:45 +0000 Received: from mail-bk0-x22a.google.com ([2a00:1450:4008:c01::22a]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UkmFM-0008I4-1E for linux-mtd@lists.infradead.org; Fri, 07 Jun 2013 02:17:44 +0000 Received: by mail-bk0-f42.google.com with SMTP id jk13so1996685bkc.29 for ; Thu, 06 Jun 2013 19:17:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=18q+siNradIt81q2FnFbT4TZIfLips5i+UJrNCTMxfA=; b=vQd7aoN0R+X9ZFP8t4V5YIgj5vSfxm2OeBWStx6EHzBnvo6tLrPGneDnAImbEm5oIl eugd11d0FHCCpnYLU6FPM05CM6PxdwEutp3QLxtUgRL4Q++DzTmyfkFXTwLc+F7GowVn c94WPqK2mEzliQLsvuMrJEKD0mPJiBnCJeklst47yjU6UaB/8bGDGf7PrYcbhQ4ckyxl 62TLMCpKfAzC788JF3bLUakvv7QMdsSviEnoJ7Gui9lDICAVsGJHr8XQFCxFOesB+ebu VW0xQMmXb+AA4gWOgsw8QB4/duj6UHYx55cCGJZbUjBHJ4QxS1Dz2qbiE76XctpYKrkK fgTw== MIME-Version: 1.0 X-Received: by 10.204.162.8 with SMTP id t8mr11857846bkx.95.1370571442191; Thu, 06 Jun 2013 19:17:22 -0700 (PDT) Received: by 10.204.39.1 with HTTP; Thu, 6 Jun 2013 19:17:22 -0700 (PDT) Date: Fri, 7 Jun 2013 10:17:22 +0800 Message-ID: Subject: [PATCH] UBIFS: fix error return code in ubifs_remount_rw() and ubifs_fill_super() From: Wei Yongjun To: dedekind1@gmail.com, adrian.hunter@intel.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130606_221744_326202_A746C51B X-CRM114-Status: GOOD ( 11.52 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (weiyj.lk[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: yongjun_wei@trendmicro.com.cn, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.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 From: Wei Yongjun Fix to return -ENOMEM in the kmalloc() and d_make_root() error handling case instead of 0, as done elsewhere in those functions. Signed-off-by: Wei Yongjun --- fs/ubifs/super.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index f21acf0..673b4bc 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1629,8 +1629,10 @@ static int ubifs_remount_rw(struct ubifs_info *c) } c->write_reserve_buf = kmalloc(COMPRESSED_DATA_NODE_BUF_SZ, GFP_KERNEL); - if (!c->write_reserve_buf) + if (!c->write_reserve_buf) { + err = -ENOMEM; goto out; + } err = ubifs_lpt_init(c, 0, 1); if (err) @@ -2063,8 +2065,10 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) } sb->s_root = d_make_root(root); - if (!sb->s_root) + if (!sb->s_root) { + err = -ENOMEM; goto out_umount; + } mutex_unlock(&c->umount_mutex); return 0;