Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp803885pxb; Tue, 3 Nov 2020 13:00:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJz9J4b8STxumxvjb3q57Gtd7IzWoNx5uPcOoz8QESoVNspd/HYwPjdvf5VWb/P4f+Vc0wh1 X-Received: by 2002:a05:6402:943:: with SMTP id h3mr23493175edz.88.1604437250319; Tue, 03 Nov 2020 13:00:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437250; cv=none; d=google.com; s=arc-20160816; b=D99AKT1RQFpHemaRv1HpfUGoZzWqjSInZs7m/mI/TtJOGioDTrx/FKq5z85Etiwq2Z b5gB6SeRSRQ6h7onW0AmRu3vQSlO36oZUCJwGW19uVVQZZSHxmcnBUHI5ySdNAmhgHGj gqE12tbuRwmVDg/bcwQU/+triuqaPgaXOBobnrwRgRVsnAlf9Qh/4dqXOgsGtT92RTa8 zKqZNUMIgtJbrsMfALZJJ0Q9NEmLzk+ym99NO4YMKrRdDbi2tLFvlP3JPBxMAIz+9oD7 bV91Rzuv6JSkdPkbcx259IrvROcDLg3RmCRLG++ZvqXn5YrEEuOyLjC4om/4S3ZNiKk1 fqQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PCaAY+ZJKAubI/dTp9dVmvP9qz03RO0BsTIwB/Qn96s=; b=hsBzqDCkt61Pt3aECznKh4en64I0N2satu2d2OBVILvXPMSQIjpbJhY3CuNwW+JAh5 9ETZszDD5wueeIWhMgOYe9jE4t0VM8xfL5Hb/S2298se+alEOu83kBHYKH+iqCAfDA+G Oed8AlglZ1P4hfJCRfXBo5ON0UrKiRRbjq/YdRIkGJerSNzjE9SaoroP4faM2HH0j4b8 HiWHyRcE9e1qehj9UXZZDPojI07MwvMpiNPHh/nLdvef9REtjvtMTGq7JUqF6eKdwNPc PL4qN3aOPH+uIP7XOVokqR8CQyxXThNaCzNMBmqQaiGlUCbwsUIdofge/aLBU4aD3kiC 91Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="bDX/dvqZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si3499932edk.11.2020.11.03.13.00.27; Tue, 03 Nov 2020 13:00:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="bDX/dvqZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732136AbgKCU7L (ORCPT + 99 others); Tue, 3 Nov 2020 15:59:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:34028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733067AbgKCU7H (ORCPT ); Tue, 3 Nov 2020 15:59:07 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 861F322403; Tue, 3 Nov 2020 20:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437147; bh=10E+evXaSoanrGML/WlMAmxK4soRQKnBX3Wuv12W+X8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bDX/dvqZ8xfQ3qmrC9t+PPyJOd4PWNqkcrKRfsuWjC8rQmTkKaljqDl4vv1ylkBTK dYJ8I3fpi+J3L/NkuTvMvj3f8C+OZ41P+N5K0Sk+MPn8dWg3ncDCs53VtjSGwid2/b B0f6zvtzzkg/crQgb4f8ooUNP62nwTeD/8CV7apw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Richard Weinberger Subject: [PATCH 5.4 167/214] ubifs: dent: Fix some potential memory leaks while iterating entries Date: Tue, 3 Nov 2020 21:36:55 +0100 Message-Id: <20201103203306.421035361@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhihao Cheng commit 58f6e78a65f1fcbf732f60a7478ccc99873ff3ba upstream. Fix some potential memory leaks in error handling branches while iterating dent entries. For example, function dbg_check_dir() forgets to free pdent if it exists. Signed-off-by: Zhihao Cheng Cc: Fixes: 1e51764a3c2ac05a2 ("UBIFS: add new flash file system") Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/debug.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c @@ -1123,6 +1123,7 @@ int dbg_check_dir(struct ubifs_info *c, err = PTR_ERR(dent); if (err == -ENOENT) break; + kfree(pdent); return err; }