Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2877431rwb; Mon, 15 Aug 2022 13:08:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR7cyy2RGzZoK5VF2prfMZ6NSQYEKLLWP45FPGJS30NrP8BaxnINYvpOLlDFoFAcR5wz5o71 X-Received: by 2002:a05:6a00:114c:b0:528:2c7a:630e with SMTP id b12-20020a056a00114c00b005282c7a630emr17677414pfm.86.1660594099999; Mon, 15 Aug 2022 13:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594099; cv=none; d=google.com; s=arc-20160816; b=g4obD0bJWTB7V0VNFVbuCDiYbBv5CDDwDE+Ip+cbtepV3r9wi5AjoWEDzMTcpHzPgu uSpwFaYslKwRk1g7gSi/cfitF8kfi9b6W9Vw464EgGNk/rEibF64611vXlpwNVKb5Hz/ LkVHurFJSkRRFOpQpWG6oy+fRg86hv+bE0nTKv7/pXigb3hg1CnMyC8rzp6BowsMqE35 b5OScE9aqGW8j3BXuz7zCeNokoZkluvQCdvVMH24ISusBolB8zmxFR+xQsAo5ECcsU+c 53Oq/Bv8t45d0vhohkPGQwqyao5VbPdU0WBSeja1LiFIv1isB7fXrJlSahDpWdd03k1k fpOg== 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=JJVE+U3uGFk9ZgTktAYmb13NIh5Lf/qEeLDSlgzwsuaNc2FIsZ+lqozl1uT5MYONc6 pZ/qUwZscCeFkTnuAkcOlet4WmUwp8bJrQth6zE7dnnoe036Ehx21JMFINXI3ACl7kje gazU3EDfKL4+m4m4TEoOpzPsDhCDHDACcr+orDV/ihsFN8/aY+O67X8RNWeivktsGSWw IJrz30u2BEVJ3el89S8lirJaT4WwVGXf4sHlZbDjx+2/r1AT7uSVf0/Dc1XzINtc+dfo X285gIN96/LJ2YiYKnagUvylTiLI6GS5sGtei/ONyDiCzE2SD38/he2iKvzJ8pPAxxZM 3Euw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2pDXpvL+; 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 o5-20020a056a0015c500b005255dd30819si11210210pfu.4.2022.08.15.13.08.08; Mon, 15 Aug 2022 13:08:19 -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=2pDXpvL+; 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 S1343501AbiHOTIc (ORCPT + 99 others); Mon, 15 Aug 2022 15:08:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245117AbiHOTF0 (ORCPT ); Mon, 15 Aug 2022 15:05:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 039314E612; Mon, 15 Aug 2022 11:34:21 -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 2562C6111E; Mon, 15 Aug 2022 18:34:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ED77C4314A; Mon, 15 Aug 2022 18:34:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588460; bh=9u+RPsdKAXeHUNT7S87LWCUibPX9fT0Xx0jOa0D91Us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2pDXpvL+eCK8hLIOxmLCaCWTUqPOSDLHRS26bm73fq4iGU+Eu8B8FgetglIVOVjuj SZL+3tG5IdHvQJmyeJQkQi51j58LM2oMXAUk9dsr6evVPMZSS0r0s3+SW+fABlnL2a 4iAcAg9bxShs0fWFVebXkQSKgtEK+t0h974qCgCY= 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.15 410/779] mtd: parsers: ofpart: Fix refcount leak in bcm4908_partitions_fw_offset Date: Mon, 15 Aug 2022 20:00:54 +0200 Message-Id: <20220815180354.803350491@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 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