Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2873914rwb; Mon, 15 Aug 2022 13:04:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR616zjsRA9QsfqH8uXf2DFKeM2m70ojiZQDOitNPWtd8Vsx5zmW1lATsRk6zrhOUXvI+0OU X-Received: by 2002:a17:906:ef90:b0:730:9cd8:56d7 with SMTP id ze16-20020a170906ef9000b007309cd856d7mr10798480ejb.94.1660593873964; Mon, 15 Aug 2022 13:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660593873; cv=none; d=google.com; s=arc-20160816; b=TD4ktWnrX+FSmQOlTdCzexldbUWxZWv7/TLNI+TksOLqOtpaU/uj6b2j2aHkSrjohQ kUjCWHbBdfYeABWFckV0hYVar29qZjWBUkEt55my0P2OvR+VrW2/aF9Xo0XmFa7PJfIR 66tKrjqieD/5LSm3E1qV5hZyDi4m6aQE/zaPqB8/8xfbFtyFP1QPF9/57NDBN29mAphv NyV9YddOsiwQZoktTjlZiux5Q969FL85hLMJl6O0zhBxHvDsCahfmx47QDJu9cWrGO63 /IEgTSA/64wF4F4f+5t+KpEXsY/B69TqMIcA1Wy7+bhPjDYsc8vOZKxkJW7/w4MXql+S e2iQ== 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=qJ+Nom+L5d5p9GRo03xxt3O2lDPBX0C+xxWS1bzzVfU=; b=vAHdrTz2+cKDT2eaOAsbAkJm/POmN4VsfCct5qcwsF6K23k804UcXQi9CyJprRnmcN miI6EPm1wpBMCE6P6dmWREVDbGnRY8QTpNBuhekF45sJO3VQOFfd0N3LhKvS7ahMKlKt K+4h47VHbhmhUHXhWSADdj4wfMbLhJxxf26K83rREOyYoyDmcMUQAJg8lEj3nObV3i9b 6mKZGSZ5nGz/qRysj8wrXqbUFOyPQowkRWHnF1a7dtZFAqy7MmSR4+6l4D+Je4ZIpZ86 LpqZuTZLUQrHHRX/rK2MmmByCF15Ga8IFoMWibRnC7LqMDZa5Gh+CKwV5B06IzNkw/bf WZ6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0YU2IFHI; 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 y14-20020a170906448e00b007309e910729si6969976ejo.580.2022.08.15.13.04.08; Mon, 15 Aug 2022 13:04: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=0YU2IFHI; 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 S243566AbiHOTc3 (ORCPT + 99 others); Mon, 15 Aug 2022 15:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344744AbiHOT1L (ORCPT ); Mon, 15 Aug 2022 15:27:11 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC63613F9C; Mon, 15 Aug 2022 11:43:00 -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 sin.source.kernel.org (Postfix) with ESMTPS id EDF78CE1272; Mon, 15 Aug 2022 18:42:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9EB6C433D6; Mon, 15 Aug 2022 18:42:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588977; bh=rCXvtXaR4ly72y2j//EvqPJYbAVPh9JaWUyU2scxMdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0YU2IFHI8y44nCwEffOIW4/t7wrcOzaKXHM88T6I0vhmigA7bm0ATcXdkZujLWD7A SggrctJAUM0wA6RxTSJ110oixFSiUvjwQTm44CC7FHTLPZ6wjRz1m0vJb+BnhH39ow iXCOO2s8Whvq0Hem+NUDQ+G1DbqxBJwIbXkpYjzI= 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.15 575/779] remoteproc: k3-r5: Fix refcount leak in k3_r5_cluster_of_init Date: Mon, 15 Aug 2022 20:03:39 +0200 Message-Id: <20220815180401.904853789@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 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 71615210df3e..54266ea69c84 100644 --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c @@ -1430,6 +1430,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; } @@ -1438,6 +1439,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