Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3013420rwb; Mon, 15 Aug 2022 16:09:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR6er/V5Empq6aSf63rE7KuKlXecty1lQYQFuMUBg/GqGOY3du1upEHMaDOwtrFzGWQKDozn X-Received: by 2002:aa7:dbd7:0:b0:43e:8c3b:f444 with SMTP id v23-20020aa7dbd7000000b0043e8c3bf444mr16018686edt.83.1660604949581; Mon, 15 Aug 2022 16:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660604949; cv=none; d=google.com; s=arc-20160816; b=ArL89mmVeH/oC0/Yg0LaCFGxpXo+W+1rBJ1zXT0QyWvj6CX1PR7pFFccf0l/rxLzKo sYHauQlX7rKDOw4pLJY/yYBU1OMDtUnzUUE39wSxnkZ5I6qc1xmnPtNJIOhCoxSJE/GC 0VkXpGXTlc+2AigfoGTOCxpr8aMz8wrokUGZuZGz4/RsVbZ5PMcmUKMFiOHV/P6ePaBw TErAM72xm39VfZBt7lxNT/6gRkIX2anGmqjpnr/CiU2t+LS+lUM75lnIif3u1U6wJ+M+ Veyn1SHKuep2DGUeUxHgr5Ma7aVa7eg9X4Ie0IH8sg4q9uDlhfYgwebQwsWJChddj3ng zE3g== 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=YUuMjdk3ksvYXzm7UP4XLZIdgLqcHYlP7V0QfKGH1z8=; b=nlUwSbaE15+o3/FjeVdcH1T7UsFUb31hn9skuGnjlX/KOvPHXcoD5ZAlRkNF0TDKxI bM1GFNbmiMkEwwiXtynR+RvgHS0eTFW4z2o+gYdNWv/eFYQnHccvsE/MsZfjf/uOLigu piF1DQkGtr0L0pTJzCgHpa88b8bkSQP5s448PNn18/oBv97ZAnjGFrDBmWrqw8qabwXD pdbqY8JEUxFIBTnGx7JjgvW/UTOwELSmGD519sZAidZZNjyxAZ1k+ifFPttwTvECwpu+ TKkaTkg5tK/weAlHxxPm+FCSwGOGzB+2BKCJm5Cczfw1FedpyA56HxjP7OU29a0uCnnW pz2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vLkqxHyS; 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 nb23-20020a1709071c9700b0073101ba70bdsi8705639ejc.927.2022.08.15.16.08.43; Mon, 15 Aug 2022 16:09:09 -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=vLkqxHyS; 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 S1348327AbiHOVat (ORCPT + 99 others); Mon, 15 Aug 2022 17:30:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348376AbiHOV1b (ORCPT ); Mon, 15 Aug 2022 17:27:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79C56EA33C; Mon, 15 Aug 2022 12:23:14 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 97A2B60EF0; Mon, 15 Aug 2022 19:23:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89924C433D6; Mon, 15 Aug 2022 19:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591393; bh=NsVV9z4D0is7Au0wRGSembh84gMxq1mQKQCq5GKTZn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLkqxHySpZXhSF7J/uSz1o+XMEhuHpZyiEoZKreeq6H4a8jQhhDSCyiCf9+pC3Ibx pNMdZOOAaI+SS2bs26xB7lD3bKOhVuwkKuWTDc05MJjkooO8hoydPk83HDrOatV8Wk 7l75DUL+l7GtaWN0a7CQOnBEaBWFn0to2DTrMBMA= 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.18 0564/1095] mtd: partitions: Fix refcount leak in parse_redboot_of Date: Mon, 15 Aug 2022 19:59:23 +0200 Message-Id: <20220815180452.900950659@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 feb44a573d44..a16b42a88581 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