Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2914525rwb; Mon, 15 Aug 2022 13:58:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR624I/xk7IzBLLmjPB9a2J/HbuWcK9fImLtr5xnMMBETutp1gkzN2ALyzF2VXG17AuUqWNq X-Received: by 2002:a17:902:f548:b0:16f:9649:be69 with SMTP id h8-20020a170902f54800b0016f9649be69mr18597277plf.134.1660597138433; Mon, 15 Aug 2022 13:58:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597138; cv=none; d=google.com; s=arc-20160816; b=IJanpN5A/dBPhEkw+0iMzYkwGfL4HTOLra5TWi3nV2zLaO9rJvkDuDNC6LnFO7nk5i NMPMLvj7jLXxEE1SnBPDO2VNbY5G1ZURhT3GRuAev6+UIw4StdYLZmkGclbJmvegX5yP UELZpycBgkb+EdjVQsIbtBT3DLFfviaNnaOmcYYfEWCynVoiKACWEkrfH0QU7cOjUJtj FUwAvOM6heMHzBO70lDcjd0iLIOQhmJy2G2Eo8Ix9rsIvAXC1D/ZOVhqkSoLWVJ9FnyD otssvlqzQcHm/G+38jfrqvFBhtYXi0/cWLvWl21UrYr4AfrrbkhDQgDburQDE2PTPbra liFw== 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=YkgXq5uHdvTqk444DSbfvyufKrGhO8MMrKW0tP6HiRhYj+j7F2pNJNPsGduYck3V7J RU5TtWPIc0WZIE3kYbxZBXwTu9cyQPCkCAvzfOV6yxB0Ha4cegiWQZjym593pFRf3WmX njgP5lI39Hfly/8dyUWDQ2Df9OIjDAZyUEdYz+v661S/rFXiqOx8AqAKPc1RSwN2xexe hwhMjpmeJVicU1sK3RujN1nKoU/dVmYbBHZqxPzzvUw+LZtaV10ufFGEODKf6cmB9qSp yV/qkiH8M/9Lgobq7iS+7+y2H/fPYji8jk5SZFFHEgOo7JVIku8Y/ioqF/GyV94LPSMZ ZR1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="wv/WH8yZ"; 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 d21-20020a63d655000000b0041a5e8f6991si11386408pgj.266.2022.08.15.13.58.47; Mon, 15 Aug 2022 13:58:58 -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="wv/WH8yZ"; 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 S1343492AbiHOTI0 (ORCPT + 99 others); Mon, 15 Aug 2022 15:08:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245169AbiHOTF1 (ORCPT ); Mon, 15 Aug 2022 15:05:27 -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 735394E61D; Mon, 15 Aug 2022 11:34:20 -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 B634BB8106E; Mon, 15 Aug 2022 18:34:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B2A5C433C1; Mon, 15 Aug 2022 18:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588457; bh=NsVV9z4D0is7Au0wRGSembh84gMxq1mQKQCq5GKTZn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wv/WH8yZSevlB/tfcROOCMr8tE8zbpqabGziU/Rq6YWLBiagrK2QPu8qsHcM5XS3e ca5kjSeFSm7N4NdLqACUbhw0Cbslr3+snm6W31m7Fm5M4XtQ1J+gOj98MQd6PwISJI 0wmiIXn2kxhB5AxofDdLL1R0eem9K85MwDZn1gD8= 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.15 409/779] mtd: partitions: Fix refcount leak in parse_redboot_of Date: Mon, 15 Aug 2022 20:00:53 +0200 Message-Id: <20220815180354.765046404@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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