Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3116449rwb; Mon, 15 Aug 2022 18:31:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR4oIIzljd4K2okBW4H+39cQL/DzqXX5LfVt7YtloqNe+e0nV94sE9LxMxlsLCOIsEGyKY5h X-Received: by 2002:a63:684a:0:b0:421:904f:d38c with SMTP id d71-20020a63684a000000b00421904fd38cmr15775698pgc.238.1660613466362; Mon, 15 Aug 2022 18:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660613466; cv=none; d=google.com; s=arc-20160816; b=0VptVJP/CF16tgkaIWkbGdDo551u3qhCj6M4bB2gd9txBz8BsAHD4EOm5ZQb2zedor TDcor9GlJGuux2/QQMbYOxODtu/hlgP+jTj4IwpvXJ2sC/Sv1+Jv4ASfWyBo5AHigrpF 197hiAD9t8TRvRukva3pBNqQBa2VHHkPdk6R3Qy3vUXMnjS5V4Z1z4TocEPOTs7dH6t9 DClwGwFq0n2b8NHacs42VyWjBD6+8h+qmFmDnPen1rIFU38TuaflGa6kTqf1cufdjbGm Muljbf3wln+iT4AKY3QcTeiMYgUULr1699hOlNkJR8QOdRXfLniL8O6WAy3mkn3N97XT csXw== 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=eJ5YJoZWQDrpFy+QES3aM6B3b1PSgDT3yBvy6H25ZqbWvNEboWu6liZ+00oY2CI25b LdRD5pk8BLXP4IZ+2ZR7jsMEBufDuoKLA+BzE52MBl62eEXIcMnRRo8//VlY6ARnjM2w qpNyAlje4oFovwjIeItcCz33LqR9RTFdHEcpmZuE8NMMHCGWwh6aCr/9u3AGrHDX6HGY YiFgLPhtC8vnW25i2wZpwhcEd21WqhOKlLW9bmFAGdQtYwSkexjtgQrqZ0Y3wH2z8nX5 OZ9lDJCEu0VAS+ItCG/dp+F6Dwu8XTIoNMBE43+90MrwwLLjBUxTOPphGzKuTCe94w7F MjRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Dzwp3x+5; 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 137-20020a62198f000000b005251a325ea0si7463568pfz.269.2022.08.15.18.30.54; Mon, 15 Aug 2022 18:31:06 -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=Dzwp3x+5; 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 S1345095AbiHPAjt (ORCPT + 99 others); Mon, 15 Aug 2022 20:39:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346717AbiHPAh7 (ORCPT ); Mon, 15 Aug 2022 20:37:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1788F4E876; Mon, 15 Aug 2022 13:38:15 -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 15F2B611FC; Mon, 15 Aug 2022 20:38:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A0B3C433D6; Mon, 15 Aug 2022 20:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595894; bh=1P0QJ7as0hYzhD5ijHWEvqmNPZKo7he6CYz7tYoqMF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dzwp3x+51ICq03lQ/5bXVWf5n0ijawsH4XdNMA3CD0b5TaMt86cZpaXOZIZ/Ee1oa 6mk2YYNfKZNNoFbFY0hCT9Cl7UJhXkPoEp6tO6q3XXOb+4FCZtVLSy4ccWDvanRjQU D7y9Yd1ATUgSp+Lmvw51xFHHiATi3hTJrWswaF1I= 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.19 0909/1157] remoteproc: k3-r5: Fix refcount leak in k3_r5_cluster_of_init Date: Mon, 15 Aug 2022 20:04:25 +0200 Message-Id: <20220815180515.821960813@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 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