Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3013804rwb; Mon, 15 Aug 2022 16:09:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR4cNk1ay4QzFvBwF8P4D0lVXUlx7yGb8YyUvns2rbqLZE/EQPyCEkjaKKzBmGHcMuHAS+Tv X-Received: by 2002:a17:906:7304:b0:6ff:a76:5b09 with SMTP id di4-20020a170906730400b006ff0a765b09mr11311702ejc.193.1660604976478; Mon, 15 Aug 2022 16:09:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660604976; cv=none; d=google.com; s=arc-20160816; b=QtixVO+4rfhvOr/2ufWhRArEpkryq8PgG9ohcZan70cusDY7iKEEs8pGBtxVK8w7SZ JScHrbxSIDexRLPNTQscmVAfIWHTxjud4EIkxKDgLYPivQqAiT/HKFkH/nSrAltUYjnn v4U4hQXm+nvQhlbr7RH7dXL8RGdcCRSoBdOVfY7mB8dB5cmaJrwCxHRr9R8pg6VWVtl3 pJo0mvBkUYlvt7eLW6Usvckq+FD0T6SAZO9QbkWnuCp0H5wK1m8gnAXjum8RP7Pu9JVk 1fYUmF9L3PUz6DtHimm9ohz2bjQ87dg2699Z3FFXR7CuMECvNtrr0MzF+DCUZOCbAN+J Posg== 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=6psOINSA+sx/Ce3mLK7R2/b3erUdaMqUQ353G1egWpA=; b=yjEQDA2ODdQcCjYcbIPViuPfhytxrcy1vGOesLuQSF6nLBy2aMOiKqB1khFS6KGXEN K9D74Ez94L5sdY0ooekouEmZoHiGhF6s2MnfvKh9B9AOWtQivISWJV6JcW+u9vWfpOnv vf6ZdR93RGbE5X7l5IKjUTH2F8qwDmPYGJzg0pfNkgSfNjC9CptCWflAKOV1UbzBYL6o 0+Gc690/BES3b+yVzEXEkiKqRS425K2QNkCo34GpP5TTDOk+lYmfdfq2Qv9+FTXwRo4j uj4zqW8EeeuvrVkHZj0jFDPr0PfUewGwIUrQ5h1ckmBw/QBxnLCCvsf7F/4FtyfXkEGv IgRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=c7ciNKPK; 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 hv8-20020a17090760c800b007305bbe840esi8720992ejc.765.2022.08.15.16.09.10; Mon, 15 Aug 2022 16:09:36 -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=c7ciNKPK; 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 S1349770AbiHOWds (ORCPT + 99 others); Mon, 15 Aug 2022 18:33:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351020AbiHOW11 (ORCPT ); Mon, 15 Aug 2022 18:27:27 -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 EF7E66CD21; Mon, 15 Aug 2022 12:46:08 -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 8D5776122E; Mon, 15 Aug 2022 19:46:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 621A9C433D6; Mon, 15 Aug 2022 19:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592768; bh=1P0QJ7as0hYzhD5ijHWEvqmNPZKo7he6CYz7tYoqMF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c7ciNKPKhbMRdX4Rv3O235jKXhD1zp2ppVD8+QXasTfZE2tIcpDNjb0oIpOYytA+O njsNYqEUgXC805Ly/rxdk++oOtr2G0/j8wkOh5SCkzOusA+nMei/vjvx4CQqpUaUWh QiTNbLiyyGEmGFfi0ZJMg9GJk48iUNiZGsrmWNEk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Suman Anna , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.18 0842/1095] remoteproc: k3-r5: Fix refcount leak in k3_r5_cluster_of_init Date: Mon, 15 Aug 2022 20:04:01 +0200 Message-Id: <20220815180504.180823954@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 fa220c05d282e7479abe08b54e3bdffd06c25e97 ] Every iteration of for_each_available_child_of_node() decrements the reference count of the previous node. When breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node. Add missing of_node_put() to avoid refcount leak. Fixes: 6dedbd1d5443 ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem") Signed-off-by: Miaoqian Lin Acked-by: Suman Anna Link: https://lore.kernel.org/r/20220605083334.23942-1-linmq006@gmail.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin --- drivers/remoteproc/ti_k3_r5_remoteproc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c index 4840ad906018..0481926c6975 100644 --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c @@ -1655,6 +1655,7 @@ static int k3_r5_cluster_of_init(struct platform_device *pdev) if (!cpdev) { ret = -ENODEV; dev_err(dev, "could not get R5 core platform device\n"); + of_node_put(child); goto fail; } @@ -1663,6 +1664,7 @@ static int k3_r5_cluster_of_init(struct platform_device *pdev) dev_err(dev, "k3_r5_core_of_init failed, ret = %d\n", ret); put_device(&cpdev->dev); + of_node_put(child); goto fail; } -- 2.35.1