Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3088434rwb; Mon, 15 Aug 2022 17:50:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR6lLhfVJrBleMFVox3BLlYRnKUJLPTxNPSgCP1ZQOeLUoVupgsy8LaeeoTXxZdBUyuvilvZ X-Received: by 2002:a05:6402:35d5:b0:43d:a02f:cbfb with SMTP id z21-20020a05640235d500b0043da02fcbfbmr16006771edc.275.1660611047279; Mon, 15 Aug 2022 17:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611047; cv=none; d=google.com; s=arc-20160816; b=gLlVgbCRLDhVTR9bedQN+xHqu7hVkgnWH3mh1LNrA4gacYPTS+O0Cl8kEQ7+m0rGuu 45d2OvrQ++0Bd9s0NqwiJp/0A+N7q8rel3ddxjGdaUsat0yfgQlK6Zb5Mu8tLl3CZPYC eB2ELmjccUF8OrwelVQjL/H8uafykEVudSpSKS0Edvo6j34JxRkeMKMIM0SiHtS9nLwK GPqL95Z40xnOU6N+mmKbJoVvdFNSNSkLBEGi+JFDpg2Ddwr2rhr9KgEMm4a+teQBR4Rq XzFzfiTA5G8CzrK7UQCRtSNtG8DE3WV5GCpLALbfInKH3kLNn7Z417nlWGzHDXhXITif ed6Q== 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=8IvQh9ULsaWyLm7NKFy6w0ZqIHJlcvctbH9toGEPKME=; b=s8rbBcoinDZr9Te2C0kgt34x+cIpN9aiy7F05OQw5Y1k4bQVw6OQS5wKVUYFq6x9LI oDcjok/TXp9e6udrtOtremZLqaf33oaYkt/eRflVFdydFn3CF5YgTAL77u0ITmKMd9S/ GyJsCfB/qHdRUROWebuFRkWOLju5A/9e4dEnzU/4QotMIHDNAjg6G36M5sLUQFR0+xH0 K8gYXc7FMCQlfrdsvaSnZuXaLNmXcy4VdVq4fx7VkBdmjSEkan8WjdbCnI/Z7tGHlcFT eI8WnFglwP4Y4LBImT2Ft2rkBBE9cnEWcd/GsWy/t1PKBMRZJltsmeuuMN0KquxxtHwS l/cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=trJMyXhR; 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 c7-20020aa7d607000000b0043d48a3adddsi8123583edr.355.2022.08.15.17.50.22; Mon, 15 Aug 2022 17:50:47 -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=trJMyXhR; 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 S1347627AbiHPAOH (ORCPT + 99 others); Mon, 15 Aug 2022 20:14:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354942AbiHPAAk (ORCPT ); Mon, 15 Aug 2022 20:00:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A11D897532; Mon, 15 Aug 2022 13:21:57 -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 4F822B80EAD; Mon, 15 Aug 2022 20:21:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E9C6C433C1; Mon, 15 Aug 2022 20:21:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594915; bh=9u+RPsdKAXeHUNT7S87LWCUibPX9fT0Xx0jOa0D91Us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=trJMyXhR9Mz21y/vNNA/PZ67Cb33rpg3lHRZiqOjN2g2ijU45rETqPcb9WAvQWCy7 KmMq5lmW7hJKv+fArmmq/c2/Wc0mxRtrKr+Vew1PyJHR3JEgF/LBt3u9XTXoNxYIAt BrDA7f2Xj1jENAgqWv7YHaVTV1+cyCbZ8it2u7MM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Miquel Raynal , Sasha Levin Subject: [PATCH 5.19 0599/1157] mtd: parsers: ofpart: Fix refcount leak in bcm4908_partitions_fw_offset Date: Mon, 15 Aug 2022 19:59:15 +0200 Message-Id: <20220815180503.622591678@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 e607879b0da18c451de5e91daf239cc2f2f8ff2d ] of_find_node_by_path() 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: bb17230c61a6 ("mtd: parsers: ofpart: support BCM4908 fixed partitions") Signed-off-by: Miaoqian Lin Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220605070726.5979-1-linmq006@gmail.com Signed-off-by: Sasha Levin --- drivers/mtd/parsers/ofpart_bcm4908.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/parsers/ofpart_bcm4908.c b/drivers/mtd/parsers/ofpart_bcm4908.c index 0eddef4c198e..bb072a0940e4 100644 --- a/drivers/mtd/parsers/ofpart_bcm4908.c +++ b/drivers/mtd/parsers/ofpart_bcm4908.c @@ -35,12 +35,15 @@ static long long bcm4908_partitions_fw_offset(void) err = kstrtoul(s + len + 1, 0, &offset); if (err) { pr_err("failed to parse %s\n", s + len + 1); + of_node_put(root); return err; } + of_node_put(root); return offset << 10; } + of_node_put(root); return -ENOENT; } -- 2.35.1