Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3409063rwa; Tue, 23 Aug 2022 04:24:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR4s7GVTol1mq/xPLyixp3Xn5FGIwMJscwEgLY3gUUa1pnN15Peafvcwg6sjp8CX4xPhp7Xt X-Received: by 2002:a05:6a00:16c1:b0:520:6ede:24fb with SMTP id l1-20020a056a0016c100b005206ede24fbmr25038092pfc.7.1661253894796; Tue, 23 Aug 2022 04:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253894; cv=none; d=google.com; s=arc-20160816; b=de+1MPAD5mQccnyVxmwCp0qQ/Q3eK+uUaUukjfwVDQmolznIjlf62JZAHxYhTWAMT2 5mfyo+eA80n4vuPHJl3/hg51IHMlwWBScnskY3N+SKALMD/fe1Wa6Gg+ocAKlU+t8YAk am39T335L4ZcFnRAXgbbkXna+tgqtCnXOcpP2fVOUDxx1t3b8Ngm/4FK9VtvgbYe/BYT zdZ/tojjuQd1N4vKUG6Kw9mkkOI9OB+vDG19Ag8acpeAxKH2ghJM9NylX6z9gnOKKu+0 P9fCpbjTET6dAs9tmyVqF6+DSLD26UGSF9kXghxXQZiuimFSc5V75Tur+2QIqLSKHDJv ap/A== 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=6+gFCqR5/pWKgtUQSreAjkBWStbKUZIBlRVCEsKrrN8=; b=wSc4wfapA+uSPEH6PgxP3q8/j+RkyuRoy7YeWqLXDFctv4IEQdNiKQqWcRaARDr/41 L6vzkxQKMb6UdN715ZZ6dVmNsY0mkMIPU7plQHcJ+6omdIq/8spf51zY5/fS2zaKBhNN NTYmgAndCmbRsndA49D2EiMsOIUyypwK7TxOeIUsjZ9Q9qI8SbTG3VL4fM2SfB8eGGd4 eZizywrjsiXy7XGh6YS7wgB0PBRD7aNj8jmOtc2Nr9G0pfAPpqXxigISs9ocQDCfOcvx cfZwStPs8mEh1VaPyPuBkWgPkoyI1gAxRnbbXakLE2gxpre9UHEmgfTJO13YOW5L14us GH8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=129IFzjy; 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 pw15-20020a17090b278f00b001fb3841e074si4691414pjb.163.2022.08.23.04.24.43; Tue, 23 Aug 2022 04:24:54 -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=129IFzjy; 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 S1356384AbiHWKrK (ORCPT + 99 others); Tue, 23 Aug 2022 06:47:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355958AbiHWKlK (ORCPT ); Tue, 23 Aug 2022 06:41:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B22B2F658; Tue, 23 Aug 2022 02:08:32 -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 ams.source.kernel.org (Postfix) with ESMTPS id D847AB81C89; Tue, 23 Aug 2022 09:08:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27919C433D6; Tue, 23 Aug 2022 09:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245709; bh=xfVhT/Ww2Zofb8/o0WAnWVFqM53cof+RjSCvjxrBhUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=129IFzjyfTJ2SpfOq9rwqfkhw+2Dn3uka2o60N58hQm5YFunrfPuADx1xqgwRae/l yOf/a8yxE8ruZpwNpgaceq4IkKwWMW/2ExRMxmQzmbssX/BxGS8qFvAjLoBTlgaPev N51T8PcQMZo2YGwvKxcORH25Tv9X32693bfY8B4Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Will Deacon , Sasha Levin Subject: [PATCH 4.19 164/287] iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop Date: Tue, 23 Aug 2022 10:25:33 +0200 Message-Id: <20220823080106.255068628@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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: Liang He [ Upstream commit a91eb6803c1c715738682fece095145cbd68fe0b ] In qcom_iommu_has_secure_context(), we should call of_node_put() for the reference 'child' when breaking out of for_each_child_of_node() which will automatically increase and decrease the refcount. Fixes: d051f28c8807 ("iommu/qcom: Initialize secure page table") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220719124955.1242171-1-windhl@126.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- drivers/iommu/qcom_iommu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c index b0a4a3d2f60e..244e2f7eae84 100644 --- a/drivers/iommu/qcom_iommu.c +++ b/drivers/iommu/qcom_iommu.c @@ -767,9 +767,12 @@ static bool qcom_iommu_has_secure_context(struct qcom_iommu_dev *qcom_iommu) { struct device_node *child; - for_each_child_of_node(qcom_iommu->dev->of_node, child) - if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec")) + for_each_child_of_node(qcom_iommu->dev->of_node, child) { + if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec")) { + of_node_put(child); return true; + } + } return false; } -- 2.35.1