Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8566934imu; Thu, 15 Nov 2018 13:43:36 -0800 (PST) X-Google-Smtp-Source: AJdET5cTLjOfhjLjJDDRWHKAMxbUHM2g8X2dsPiL/S5gmawSYAklwl1Lm/ALQbhJzIEaD8vVDrm5 X-Received: by 2002:a63:cf08:: with SMTP id j8mr7557895pgg.113.1542318216106; Thu, 15 Nov 2018 13:43:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542318216; cv=none; d=google.com; s=arc-20160816; b=oIzfOSMzCmnPXBrgI5jrY5KqS82BjE8xxc1nFFLBJ9CvbghmrCJjgGhxW48LOtXvsq UtPHnEEBVk9fSgjF5IYKtnda3BX9m8kLpZ0ZQMFARZGInPrQc4oR+beZ32MpB9kbFiwP wU5DlA2ewjUQiK0dEg6tlkiUw/yXMI3Ks0nFz+z/yDC0agw/FqNt2q+RWkKzj1JvGS/B qda95i8D7bssKwDHhpXZmLJegErOR6pvnL2qygXyfVDaccROsHW9v1dcwA1t0OvbhS0K k7UWc6tRp9wH09olmlEuPxAnyqqetG37Ql+csPiViui6EmY1uKeVIsJG69rigFa63EbH xNkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=4uGVr9w8nZrGt9XhSfkCq1sIp5mpUNdPWznsd8lBVSY=; b=PBfgacLBRJnH8SqxvkbvooHURco3+NtYcr2U3cDSkdJU3214uWD/xNRJz4LYxcFms9 mbpQB0KBzrbrDyq+YC2PKHmfNnFXvsyvByc13Ya2rR9hSPh53wk/7W8u4Vrhdx3KbPeU +Hi+PfuYjW+85UFm/3Fdd6/HWqF+Geo9wSK0QSmnhMMz8hK3Jgf4YY62fCJIL5G/6NT6 1JYjwGFsrHBlWsW4bdSZt99bQ1DL/yHN57zwMQKSTnNiHIPoDKjIZIAANt4FBFD+E6dP 1TwEIajgC9iANiioqdRWGlGfrDsgE5N1KsUbE47UboKDomjrt4Qib3oJYIA78ERTWU+l CnMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12-v6si19013118pfi.286.2018.11.15.13.43.21; Thu, 15 Nov 2018 13:43:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726808AbeKPHvr (ORCPT + 99 others); Fri, 16 Nov 2018 02:51:47 -0500 Received: from lithops.sigma-star.at ([195.201.40.130]:39040 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbeKPHvr (ORCPT ); Fri, 16 Nov 2018 02:51:47 -0500 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id C1B4B608A381; Thu, 15 Nov 2018 22:42:12 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id IsAyYCU2jRgk; Thu, 15 Nov 2018 22:42:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 7B61E608A38E; Thu, 15 Nov 2018 22:42:12 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id nAVEI7qlX_Qx; Thu, 15 Nov 2018 22:42:12 +0100 (CET) Received: from blindfold.localnet (089144210006.atnat0019.highway.a1.net [89.144.210.6]) by lithops.sigma-star.at (Postfix) with ESMTPSA id F14D9608A381; Thu, 15 Nov 2018 22:42:11 +0100 (CET) From: Richard Weinberger To: Garry McNulty Cc: linux-mtd@lists.infradead.org, dedekind1@gmail.com, adrian.hunter@intel.com, s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, colin.king@canonical.com Subject: Re: [PATCH] ubifs: fix memory leak on error condition Date: Thu, 15 Nov 2018 22:42:11 +0100 Message-ID: <2181429.CC2M8HkSot@blindfold> In-Reply-To: <20181115203850.5774-1-garrmcnu@gmail.com> References: <20181115203850.5774-1-garrmcnu@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Donnerstag, 15. November 2018, 21:38:50 CET schrieb Garry McNulty: > If the call to ubifs_read_nnode() fails in ubifs_lpt_calc_hash() an > error is returned without freeing the memory allocated to 'buf'. > Jump to 'out' label to free allocated memory and return the error code. > > Detected by CoverityScan, CID 1441025 ("Resource leak") > > Signed-off-by: Garry McNulty > --- > fs/ubifs/lpt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c > index d1d5e96350dd..c162459a1e02 100644 > --- a/fs/ubifs/lpt.c > +++ b/fs/ubifs/lpt.c > @@ -1688,7 +1688,7 @@ int ubifs_lpt_calc_hash(struct ubifs_info *c, u8 *hash) > if (!c->nroot) { > err = ubifs_read_nnode(c, NULL, 0); > if (err) > - return err; > + goto out; > } > > cnode = (struct ubifs_cnode *)c->nroot; Please see: http://lists.infradead.org/pipermail/linux-mtd/2018-October/085081.html If Colin won't send a v2, please do you so, then I'll take your v2. Thanks, //richard