From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F08E7C55178 for ; Tue, 27 Oct 2020 15:12:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB3C721D41 for ; Tue, 27 Oct 2020 15:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811537; bh=bMuu2SKQBLQ0noUW6mEQ9MKF7f84WKR0o3cblm6N2kI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=h1tNlaPISflIA9XjTBSEpx+tTivDEPCeO6wUxSvsU8Of/+APVA6lCGY3EXu64dEie a/NVgPTuY9W8CEMpQ/OL+mhW0xxdcY5rLLeDzTbyqGbXh6Cz/ybF9qxyaPSoAF2mWX LIfX6W2MA1HvFOxv1Jg++o+7YVqyiSNUd8QX6QhY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1794532AbgJ0PMQ (ORCPT ); Tue, 27 Oct 2020 11:12:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:34716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1775351AbgJ0PBB (ORCPT ); Tue, 27 Oct 2020 11:01:01 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5A5420714; Tue, 27 Oct 2020 15:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810860; bh=bMuu2SKQBLQ0noUW6mEQ9MKF7f84WKR0o3cblm6N2kI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WX6GDNzNfPOL5JTyQkmEC8Kt1rjybyflzLomz0g9Us6Wxhb02RNBiI1BkkjWou1nH X1tPxI/cj7I2yBeVg0vw0QJ/wmav/g+GDzbLdyF37E0piWSDrJXKVWJ6iaATlVJWFI 3qqpNW0RQI4ST56/n6i3XxJDqIgf8mN9ZCmG+gz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Yu Kuai , Will Deacon , Sasha Levin Subject: [PATCH 5.8 289/633] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate() Date: Tue, 27 Oct 2020 14:50:32 +0100 Message-Id: <20201027135536.227868014@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yu Kuai [ Upstream commit e2eae09939a89e0994f7965ba3c676a5eac8b4b0 ] if of_find_device_by_node() succeed, qcom_iommu_of_xlate() doesn't have a corresponding put_device(). Thus add put_device() to fix the exception handling for this function implementation. Fixes: 0ae349a0f33f ("iommu/qcom: Add qcom_iommu") Acked-by: Rob Clark Signed-off-by: Yu Kuai Link: https://lore.kernel.org/r/20200929014037.2436663-1-yukuai3@huawei.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- drivers/iommu/qcom_iommu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c index d176df569af8f..78d813bd0dcc8 100644 --- a/drivers/iommu/qcom_iommu.c +++ b/drivers/iommu/qcom_iommu.c @@ -578,8 +578,10 @@ static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args) * index into qcom_iommu->ctxs: */ if (WARN_ON(asid < 1) || - WARN_ON(asid > qcom_iommu->num_ctxs)) + WARN_ON(asid > qcom_iommu->num_ctxs)) { + put_device(&iommu_pdev->dev); return -EINVAL; + } if (!dev_iommu_priv_get(dev)) { dev_iommu_priv_set(dev, qcom_iommu); @@ -588,8 +590,10 @@ static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args) * multiple different iommu devices. Multiple context * banks are ok, but multiple devices are not: */ - if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev))) + if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev))) { + put_device(&iommu_pdev->dev); return -EINVAL; + } } return iommu_fwspec_add_ids(dev, &asid, 1); -- 2.25.1