Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1880732rwb; Fri, 19 Aug 2022 10:59:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR7vSkyneHXyeo3HVHsArh0Wf+g+tYZQ/ZALJopSTY1qauctD1g265zpk712NgKNNE9TkGsU X-Received: by 2002:a63:6b06:0:b0:41b:79cd:f364 with SMTP id g6-20020a636b06000000b0041b79cdf364mr7363245pgc.119.1660931996143; Fri, 19 Aug 2022 10:59:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660931996; cv=none; d=google.com; s=arc-20160816; b=Z2wfWrNDb1OUig6jCIINwyRZGHMO2yw+wHBiYpW4as9JuzpngFu1e67p32nWJSF8GJ oxx/RAlnswnkarU5cNvm5KTn/LZnXNTPqbq0+Yrzgw/LHmBam3qwn9Dz++Loc5KXdP63 fDqkd0nFHgTjVT2dGHSmzzo17mxgTEWNwfVku5X7WjIwaAU98vcqwfx+x26EzD6L+CzV mwGAWO3gaufcN3qEenx8iZCYinbUPyq+1XOqUjwZC88bnzDRwtEwG7sKB83GNP7PC+Go B4VrF9Qn7YrrShhOaDH3+SMdlLw7ec+cB5IsLC/pu+5ZQ9VO4U5pJW65SdExg1qcBnC2 5J+g== 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=MUyOguPjTBGwqj5+oRBX6WweWlYdS6zzWlTrhGNTQIw=; b=ZJWwedbAQLk9AP3xE8GaZiMxN5ajErJHFPgiqfVY8Kzha93QoTPE49hXJCi2UyFHmk 54Yq2kxOsNDrSJ26bsYdiDJ4jImsn41/6YsuK0VIrZOldN/KoNMzsT1uHyd+TFrBPnet wmpePX/tvWAVWbvOGvxQf56De8yj+ESSHEFHZDMSfSaCGW279GsYb4Phkaegqj+MJ4DJ /wNkSnkyDhuszgWir5D/XEuP1kzXd9fWW7zijn1fpCEd+L+78M5WyTPj4LKBCSo7USI/ qB7Ou7kDA3QXXaMaAhzCeHwRGdfg5dYhxYckXnp9CDPbdYL/Bpo7Fyq0DsbvYJpXGmSL n/Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jjqDoHQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a170902c95000b0017275762141si2864046pla.355.2022.08.19.10.59.44; Fri, 19 Aug 2022 10:59:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jjqDoHQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352428AbiHSQUx (ORCPT + 99 others); Fri, 19 Aug 2022 12:20:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352364AbiHSQQZ (ORCPT ); Fri, 19 Aug 2022 12:16:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C57511156E1; Fri, 19 Aug 2022 08:59:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1C72B8281E; Fri, 19 Aug 2022 15:59:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D2DDC433C1; Fri, 19 Aug 2022 15:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924772; bh=w3ajHmJFOhAEub8nrPwePEcPTAGm2gxNw+rC+5X+vMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jjqDoHQ3QZktaPc5I0i+IFqIC87zAYkOlwqTH6iGJiwXYSd/IIW+Lo5yUUcj0NE/d VavGqV/lKHz3YYLvFiLNk2NWcBrkFckMxY8wTAXs1++iIZnwnGy+GHYxNEVrppv8H1 Wva9k1BoIBzHdWKxSu2d42PozwapQhX+UXF6H4Tc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Miquel Raynal , Sasha Levin Subject: [PATCH 5.10 276/545] mtd: partitions: Fix refcount leak in parse_redboot_of Date: Fri, 19 Aug 2022 17:40:46 +0200 Message-Id: <20220819153841.681274622@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit 9f7e62815cf3cbbcb1b8cb21649fb4dfdb3aa016 ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 237960880960 ("mtd: partitions: redboot: seek fis-index-block in the right node") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220526110652.64849-1-linmq006@gmail.com Signed-off-by: Sasha Levin --- drivers/mtd/parsers/redboot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/parsers/redboot.c b/drivers/mtd/parsers/redboot.c index 3ccd6363ee8c..4f3bcc59a638 100644 --- a/drivers/mtd/parsers/redboot.c +++ b/drivers/mtd/parsers/redboot.c @@ -58,6 +58,7 @@ static void parse_redboot_of(struct mtd_info *master) return; ret = of_property_read_u32(npart, "fis-index-block", &dirblock); + of_node_put(npart); if (ret) return; -- 2.35.1