Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3024589rwb; Mon, 15 Aug 2022 16:22:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR7NzAVnej5bK/r0EolqRl2+2Kl2fzGTDyxNmoOGH0S5cdVUJeFHpy92qACoM825exNy86UM X-Received: by 2002:aa7:8890:0:b0:52e:de90:7338 with SMTP id z16-20020aa78890000000b0052ede907338mr18553887pfe.46.1660605753321; Mon, 15 Aug 2022 16:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605753; cv=none; d=google.com; s=arc-20160816; b=M19vFVIipgZnQCmNiaZ76vzy7t0b3+OQaWo7HVBFTA1DY1YjyRidJrSyBGOYZx+OBU RXpBeqV81ZZc8qhrtRq2mqswu24x0nJ39iA9WZU7dgtlm4x1/FL1j0xsp7dPK846D+Ic j4oD1COBAsbG2Fs/4kzBmu97Sb4fUgmZZK+rUxqmzyEWh/mW7eROL3prz2/l/Cy2AYM2 N23JZ6BeBBw8VU/T95CI9EpeikyUW87+9qTatUr5JJqUfgVMNjnBSz0d5mIs5YSv9Ul2 XfFKu8w0OS9z1Ub/IlOS4bqM5CixdZJdn8Rm2cw7zRaSEKL214j/I4pO+H4gbXy0MmFi 5YyQ== 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=0RIZOG43LcgZiDqQsT5dP7haAzWWSTM68WDYhEbN2D85VJ0g2/WJRTzActXOofbvGO ZzmUJuH4ZKRVwtOL+7Q7j7EXesGYyRYcPy32aB7nvA8Nu4qWe8NzYmbN2XXruS2M/Q31 ybR370VS8QaHGNDd9HTHqPFwK++qAJ2BbBar+Xjr5Op9ClY0bDdIororjRsp2IDmiGR9 sXMSi64ac0zPpuQofhjr/J3dZkXCaaAHQu28gzOjjnL72GwASpMURoepvtblYWIE02MC bHpGJPTtzsU/ur6wZiDHUZWUSCe3CciKjB6BO8f/H6D/BtemMoOhrohMLSSp5d17lCZl WHmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xIhGaBID; 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 a64-20020a639043000000b0041cb4fc5adfsi11219903pge.387.2022.08.15.16.22.20; Mon, 15 Aug 2022 16:22:33 -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=xIhGaBID; 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 S1348347AbiHOVa4 (ORCPT + 99 others); Mon, 15 Aug 2022 17:30:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348398AbiHOV1f (ORCPT ); Mon, 15 Aug 2022 17:27:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84F5FEA88C; Mon, 15 Aug 2022 12:23:17 -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 B3BDB61024; Mon, 15 Aug 2022 19:23:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4B3EC433D6; Mon, 15 Aug 2022 19:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591396; bh=9u+RPsdKAXeHUNT7S87LWCUibPX9fT0Xx0jOa0D91Us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xIhGaBIDFH+ZC1M/H8B4/FFDdwzrU2MgKJ6brG7PWgY6VsRN5qa5eMNrqELRDaHsH sJ3ANpsUeCCWW5gPfJwfwPPLc6cx1WNBrM8cAAsvjEUvyTV3gni2rKfLyV87x8zkWf O3fWsYPNpvP/4AZbMJ2cD5TtA2K0MYLEyjfQ1vqI= 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.18 0565/1095] mtd: parsers: ofpart: Fix refcount leak in bcm4908_partitions_fw_offset Date: Mon, 15 Aug 2022 19:59:24 +0200 Message-Id: <20220815180452.949493279@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 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