From patchwork Mon Dec 3 14:47:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 1006951 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qNF3jtWB"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="e8E1ExrH"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::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 437ntJ49PGz9sCX for ; Tue, 4 Dec 2018 01:48:24 +1100 (AEDT) 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:Subject:To:From :Date: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=+hKTzXBsTvGwW9RzCm5fJGI/PM2J1J1Xqgvv68QusXg=; b=qNF3jtWBMjtjmr JFIgJPG17pkq4GVJrFQWKGBGyqc8gtkaXIY+ds5wW32VPUe/zwC/5WVVl1Z3aN9afHQXrj+3avUcl Rrdn0oUqpWe9z1znPgxC2c9YWkQ0ik4e62sARJzjwB2JfCvnTMRVmBlU5IbSclN7fCpUkjXnNjFps vwVT6vxrCYKcEdd+zH/yficnBwsbV9vZhyNnI+ybhwbRbz3wbUFcqhNR8GM2Tn1DfqeoYl+M6mUo9 ZNC0ifL+FDCK0bn5r7MlaReW4sw4BfqGqxFl6tbSyFWH25jYeRcaC5d1gDP0AGlQg+K5HcnpYFckb Idb+gO9HGPefFKqgkhnQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpWF-0001J3-0x; Mon, 03 Dec 2018 14:48:19 +0000 Received: from userp2120.oracle.com ([156.151.31.85]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpWB-0001H3-Cu for linux-mtd@lists.infradead.org; Mon, 03 Dec 2018 14:48:16 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wB3EiwXx196281; Mon, 3 Dec 2018 14:47:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=6bxnpcPEymiJ5lg+8Vwvm52HUOFuoHecXI/7D8U/zjE=; b=e8E1ExrHxPag383uoI8rNIJ06ChI0YMe3C894g99Q2vKhWWKORNcNk9Pd7G4B21AhGFx 4Z17VlEC6lCkqFw1M2tAZte+/QnfgCe7yNPx92NvrHb2s3k6GwN/CEZEEt4v0cIABQOz Hpu3Cjq8dGB72PgauBBmEr5DTwskLV6FeSAs1zODAkBZjX7Lmy0EJiqAArKSJsK6qLRY yULP792jBiIqSav80tOzUauEkqWQbVh7J1xcrs6bBckJbXL5MvWnfX/0To2HfV0V5GxM AQR5y4PESMiecerzRy6Bl7nx5IdsAIt1oS39NdN+H3RXyD36ts7YLXEqAsKsjT+IXbOQ YA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2p3jxr6ppj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 03 Dec 2018 14:47:58 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wB3ElqRC007003 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Dec 2018 14:47:52 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wB3Elqn1028153; Mon, 3 Dec 2018 14:47:52 GMT Received: from kili.mountain (/197.157.0.63) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 03 Dec 2018 06:47:51 -0800 Date: Mon, 3 Dec 2018 17:47:43 +0300 From: Dan Carpenter To: Richard Weinberger , Sascha Hauer Subject: [PATCH] ubifs: fix a memory leak in ubifs_lpt_calc_hash() Message-ID: <20181203144743.5p6ve64mw32y67oy@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9096 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=747 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812030139 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_064815_523948_7F874CE3 X-CRM114-Status: GOOD ( 19.73 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [156.151.31.85 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines -1.7 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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: kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org, Adrian Hunter , Artem Bityutskiy Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We need to free a couple memory allocations before returning on this error path. Fixes: a1dc58140f7e ("ubifs: authentication: Authenticate LPT") Signed-off-by: Dan Carpenter Reviewed-by: Sascha Hauer --- 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;