Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3094344rwb; Mon, 15 Aug 2022 17:59:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR4iyaMlXVdtZdoE5U4MWNkf9dhdTbxW60+atpSr4hqopMCoHqSrb76j8+kRvxGnZsnrbS7w X-Received: by 2002:a17:907:60c7:b0:731:17e4:7fcc with SMTP id hv7-20020a17090760c700b0073117e47fccmr11877480ejc.73.1660611587766; Mon, 15 Aug 2022 17:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611587; cv=none; d=google.com; s=arc-20160816; b=p5w5odVZbm5+je/sCLpOcXPRmZOq6tjtXQ4f33jsxTknvtLoGxP+Hx0Te6nVhai3db 9ff7li09Y2u36UBbKarUeIYIdMtulu866Bmm9hiWGvKwCFe4Sy8PCPGGzLSDbX/mxT/L dguaS7cNH4daflRHeWJmZFD9uK7SdqBDKdMWxDLhdL3DqMUpuLHQGFt7WTnbMhA/MIRQ OqM3FAyBU+Kq7ngIOt3XpiW2JrrFTi2up888m3gfX6rAZ/5LFwwuCYet1xW5xAaEEEkQ AlbTe54N4tYqCR2Ni4emK0NPGaddOL8tCvLIK4GpZV9NTKKYxiUDrZGwXnbuGCCs0EYE bi4Q== 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=ZH1Iqm77lCz5sUWPLwLG8aYrjc9FZWYjMhkPnuzdQPs=; b=q4K2uXAbj6AfR9T5uC0QDYoRNW+j6bVXTKz6EPCOwU0CYmujQhzp4umydazHSu8gct EEWM0XAzqpXGNqEpBnRbI+cIPPAyVPnwd0rjO85trvvJovfEHCmcE9NPVb27u8DHl/4v PqgPrqwQs0/2OQNvhGlU/zXxgH363W7SLbgRCADvIvipWF2pSifYPshjW9v+WH1LF67B /XiavBLamgshmsnkFoCSN8tDU2Cs9kbICtoGMEzQpoDsEfxVxuNveZhEuHubt/l3dYSo e8QHGQq0LiYZHMq2E2Xj0Ey8AKd2NhPQ/QF1zgX6ZBJehj7vgaxz1HOaRWlNuhJs+efC ZIoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X+xJip+s; 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 ss16-20020a170907039000b00731c0576129si7202843ejb.554.2022.08.15.17.59.12; Mon, 15 Aug 2022 17:59: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=X+xJip+s; 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 S245406AbiHPAsC (ORCPT + 99 others); Mon, 15 Aug 2022 20:48:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244497AbiHPApc (ORCPT ); Mon, 15 Aug 2022 20:45:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E913B4E868; Mon, 15 Aug 2022 13:42:02 -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 AC64FB80EA9; Mon, 15 Aug 2022 20:42:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00E2CC433C1; Mon, 15 Aug 2022 20:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596120; bh=lCT1j9g6C8VJGJ3kCsSS9uDzFCCqHmR/3FmqLXKyelw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X+xJip+soStYJCJpSs0mEBC3q1l7vyari3bEnQ+GOBPSUEG4UXdPTZDcXGdc4c2j3 ALMy6q9fF9VGAoSOF+/6Pib4S9wZsSIt46+VW8ZAoY78rUw7o4od0RZ8hJnKt7jJ6Q xobTTPbdFfOXSFIJGS+sCn3vIsexlkTaRJfs0VFA= 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.19 0972/1157] iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:05:28 +0200 Message-Id: <20220815180518.588991920@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: 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 4c077c38fbd6..c11d2c2cbb62 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -750,9 +750,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