Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3269038pxb; Mon, 9 Nov 2020 07:02:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJXgjoZM3N0bufATy3qn3oph+5ehZXSGNIjRrsMEI/jS99/w07/ZOPyfcua5XQvz8B7T+e X-Received: by 2002:a17:906:2581:: with SMTP id m1mr15044904ejb.28.1604934129507; Mon, 09 Nov 2020 07:02:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604934129; cv=none; d=google.com; s=arc-20160816; b=gkzpiUtnEOfA758ivcH903jWt1/mecjdcaLrttyjO0KhCDer/68x5pdHu0kz1NLlR5 KBs1ibAxPgDSkFiaeMDUz0W0bsXl5nUbluZJmDPlve/6PP97cgsL49oeUTrnQeHq3Z9m KcNtu2r1IFkHrYOp40r3jWOa8T4kT3pPHTvGE82ZZqoDtNGGMLf7Lx3InsgjjBnGjl+R 3+4NIDDCaJkt6P1CiTX4dPOC46wYqW/a5pecmFXolqiedPjZ9vRBym5spbfSVuYjwJbl /CDfyYxTA+8g2BjjAi4tNnzYAXSPQlmhKMqIiGAEMuAdSWwvuvq4rbHyTiJFZjjhx/th Fjqw== 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=YJY6LbPpEHfKjUK0S1zUZm3FnWS21gMm7VBFJq/QiHc=; b=0ZX8Veh+DqU5zMgJRm1MmyWoR7KrL6vGAUJ3s/PaKWSJTzJqmgHCoPQt6jP+0q804x fsvayINJ1ah1LlGXaSkeIf3ybZdw4M+go/+N4795taZ751u8wDdYePpGl4M/jvtN7XTW BHHUZyE2ws+nZ7UJcL0f+RSasWsc4fmmsF5YtSotULGTtr7HZPke0rOEeedgzn2f75V3 iIkJhRk1cubW2VFiFwm1S2mjdJgWjbIqZTl+JpkH7dKlpnHShrv1e2Uk7WKqg3UrxTlL tuMBJ46bofGBvMpnGYjVjNuGbkFCqz6qQOJP1sQAp7QccdKdIuLIcLHKIel8OddrClRf VYEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yx1+sSdT; 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 dp16si8072604ejc.635.2020.11.09.07.01.35; Mon, 09 Nov 2020 07:02:09 -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=yx1+sSdT; 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 S1733274AbgKINoa (ORCPT + 99 others); Mon, 9 Nov 2020 08:44:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:53362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730268AbgKIM7J (ORCPT ); Mon, 9 Nov 2020 07:59:09 -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 E013E20684; Mon, 9 Nov 2020 12:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604926748; bh=eSPdUNSrzMNvWnZGQeWWlmUQk5bq+1LKzjc1HE76wjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yx1+sSdTfGtm7Xzx3FnnH2jPECFbYW5uSpoUR2EH2c0y4pKxbjcO1SSPmdVXyYcpX z+yLYOeRJKF91Bxn9aunK4GessXHManKilFr+WjF6VEkTsNVlQwuZbGjqcoJKxWI7e cnxxifqyQl0OIfjgk2uVe/BdjLWINlM0n507ShQ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Richard Weinberger Subject: [PATCH 4.4 47/86] ubifs: dent: Fix some potential memory leaks while iterating entries Date: Mon, 9 Nov 2020 13:54:54 +0100 Message-Id: <20201109125023.095438682@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125020.852643676@linuxfoundation.org> References: <20201109125020.852643676@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 @@ -1125,6 +1125,7 @@ int dbg_check_dir(struct ubifs_info *c, err = PTR_ERR(dent); if (err == -ENOENT) break; + kfree(pdent); return err; }