Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2885418rwb; Mon, 15 Aug 2022 13:18:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Lz1miA1ILY6E5i+6gluOi2jXpon1XK+IVMoU+ma4a5oGusGvgZ2u58jP3nW9w6pga0uxN X-Received: by 2002:a62:79c4:0:b0:52d:cd3d:2027 with SMTP id u187-20020a6279c4000000b0052dcd3d2027mr18266578pfc.71.1660594683306; Mon, 15 Aug 2022 13:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594683; cv=none; d=google.com; s=arc-20160816; b=TbR7NgkBJ4WHZEtZlTqljmbygsZJqPjpUzA3OxOBb63iDuhWv917QLxHnw5eGy9Lpx pGRvGG0ETMjk2uC88/NYui5UKp1jlKfm1UAem/y30g1i8TEXu9PAXl+9TYXjSTvo7NvE eMoE87sS51vnNqwN5JRF09KDrf/kCVHKIrcpQHV/ls5ffvaGBMBbxpPgzjp+oj5Ct/wV MwCTnSHJt5IioZn7QK+Y1/oAURQgqZvTaPVHd9Tol4ie+jPAAke4GY+bpX2nIqw9hMFk OkG2IaqSmsSbggy+xwOAk5GMlCYmGZ0ApB2wWnJCDiHMT/R/PncvQhu8icK6BPSSmu5f rUfQ== 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=64EFN41vCLNPgghZ8vJQPnIPcPqSqIm2JVInNpc1yvA=; b=rJEJBotP4QB68hdE3yHjhVDaqPH79HUqf79IKE+q+me2bF05BZ1oKm5/XZnpZt/A+p x46Enx5+mzgS7q98T98aSq61h3JJGZRmePkhfQa+1iKg9Hlc/IKK6gEh6u2Jqnf5Dilg nX+h8zskeelQb31z41cIoVa8W3XVCE8Exd7X2eMKDOr6gSwIgbdNHcs/IfdAPEUsjQAZ xeDwr5WoED+lidw0U+Wd7ozUroaP8aCpykJBn/hMOOHuhlhNpL/CzEgNXMKnaYqR5GUw 1ZrUfLYT8fP4ZeR7U2yMlOJwbnC45s1vjYaNjy/3n8oBbs1eNbhKN7xZKd+nmZRNpClG uQXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2M3CH2dA; 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 j7-20020a17090276c700b0017086b1c40dsi10692009plt.400.2022.08.15.13.17.51; Mon, 15 Aug 2022 13:18:03 -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=2M3CH2dA; 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 S1344123AbiHOTia (ORCPT + 99 others); Mon, 15 Aug 2022 15:38:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245576AbiHOTdu (ORCPT ); Mon, 15 Aug 2022 15:33:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D62EB10A1; Mon, 15 Aug 2022 11:45: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 D00A3611E4; Mon, 15 Aug 2022 18:45:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA871C4314B; Mon, 15 Aug 2022 18:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589114; bh=SFI2MM/IZGUbUrOQF7HrsxzLRHIiI8peA5d7xXudR4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2M3CH2dAwnahnm7v+Ic0fSK7NP88OS2ZR7ELVK2VuJXHD8zaHcuimIvLVOZx+dGtD Lq1Cvk+w+4F8V7r9CzY2I88fQhHBWitMiBZzgKDj0b27uLko/nm7Clv4lMQflpWLPi ySuc8N9wGZ1+ML+6i1pzG26NcgDhMC4bSikYxD4w= 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.15 617/779] iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:04:21 +0200 Message-Id: <20220815180403.739053904@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: 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 b91874cb6cf3..a47cb654b704 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -748,9 +748,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