Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1863834rwb; Fri, 19 Aug 2022 10:38:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR6I7UDtP0On+FtNShGeyWbWYHwmuYPqzuuz6jHGoqXb3wmJBP1BZS8yfwM0kevlVthASF+N X-Received: by 2002:a17:90b:4a05:b0:1f5:62d5:4155 with SMTP id kk5-20020a17090b4a0500b001f562d54155mr9842415pjb.6.1660930727662; Fri, 19 Aug 2022 10:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930727; cv=none; d=google.com; s=arc-20160816; b=PxMePd72feoSeuoI5D0RsQWU/lWc7uu0fTGRrMbBZlX06r1WQD50kshB4hPevztBHu 6ZnYH6dzF4QhH+XoSmAICcSxBR0P34E2y7lEXbmOSBi7hwPnQqxFS/DZQyuPUNoGl5kq TN1NDrKBOBhSJezmSH4nqZGUTL4QAYW0Wem/zqH+D0405PsbgTPmhNTCr1scKMB6PtXh 0hx2IrsHRq+xWtDy7iUCredY3oywbZamJnG2nCEpUz0e74Ud/DdBnNGu3SblVfUuETSE o239FLxIyIJ8eICviAPLjESL/xcUTNjPZjvvFVl53hXFvcAUpY/s49yDDo1LWLNd9rWm gfcQ== 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=bnkg+ZT7ASrcAP0dCuy0nEwEtFRCoJjLGt3LO/ZB75k=; b=Nttp0v+r3wgpMsc/UUhoRVJQvudF0w/7LpAG78ShC+hqnKY9S4owWM/avWpI/YVEna l2haIKgBjzKvzVRpX+9tBjDOUMLeg8xPZhzbIatCgYYNfJPLUWKOYKsmFhiiCWpnq4Jg FbOBOH2wLkVAjlDe3zDFRnsE+2Ja5D8BkvuRO9u7r8e/4876/kRinCCUNnvKmqBczi4r Tq5/3VDu5SPqDXe+veThe3AzbAC0jYIYHnJXjXDQng0ezsg28DIhTwDrc7FPv51E18wT PwbNl3cmhXcS4/zb1HG4SRJJs55mXLrI11hEuMjlKM6UzLwymwAb0JKAJL4wPHcksImH G6VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oBe26MrL; 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 203-20020a6302d4000000b00408b873b681si4451892pgc.743.2022.08.19.10.38.36; Fri, 19 Aug 2022 10:38:47 -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=oBe26MrL; 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 S1353428AbiHSQfr (ORCPT + 99 others); Fri, 19 Aug 2022 12:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353570AbiHSQcD (ORCPT ); Fri, 19 Aug 2022 12:32:03 -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 78DD911E922; Fri, 19 Aug 2022 09:06:11 -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 CFC8761828; Fri, 19 Aug 2022 16:06:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5A7CC433D6; Fri, 19 Aug 2022 16:06:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660925168; bh=z/UO+2PwZzvfVwCT7IfKCqZuNzeSaV93JPtQ9ZEOdic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oBe26MrLb3yvMhZbzbb9wWpHFybJkhAoT6xVr9cYOAFYGryEjR3l4p0xBKQYZtxEM qHqW3MXzxBKFLtalAlBELlxc87FUNVbPmpN6BbpTVVWKc6mJYkOylnbq9oqGo0AgOy k7+Av7xyodsx3QYlr6dxSEXawmszeTc32CrUwyjQ= 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 5.10 404/545] iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop Date: Fri, 19 Aug 2022 17:42:54 +0200 Message-Id: <20220819153847.517939867@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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/arm/arm-smmu/qcom_iommu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c index b30d6c966e2c..a24390c548a9 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -766,9 +766,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