Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp277793pxx; Wed, 28 Oct 2020 04:50:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1cts20e1sAZqnwxhExXPT9efM3QPqGoEIjQ439P8Vi6Atdckn3y/162y5KzuiKuJTOnyk X-Received: by 2002:aa7:ca4d:: with SMTP id j13mr7103031edt.119.1603885812317; Wed, 28 Oct 2020 04:50:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603885812; cv=none; d=google.com; s=arc-20160816; b=p5MamB1CP97J6neSbYjLtR3OnjpHTBK9BC4tgt25XPjNpiGm88KEYoj2mzgZSAFdFr qTcXlgsBpMxwJ0L9JEYGcqoDWi7melGEl2oWGG72MVmO9GMMOhf9FkXBBbgxTwa0bOzm CBQOo+1gkKugFcatSs7eqJw/MyuPmW20G0wlk+skyA6UqvhaC7zjQU6RGpdO2Gdu8/0k 7sLHA9pJ+yhGxggNQJD/HwJWEGuQlZ7S3kffmZya19BMOLuO4Yqxv1i5vzKlVSY5jGnl BhqWTAqRdIRsYWmyJTx2ov5ZaITTxev2g+H6Py4C9w6RlRtdKMrB6UkQfPMU1/sfaN75 JKXQ== 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=oqmMRqa89nRocnSfkXDWT1Hj4fVnlMEJGq3xpgnY1rM=; b=WF5Hw3R0J+dUGBIaiW80HzMPzkKirJ4PMDsb36DyB6MFP0CD1rp5KLOv9LaUPcuf1z CduVgkpRnsPn+ZgtVR+FjTlpee9Y0q0WBSUBYKbtAn1Dvlvd5EWv1Er/rVEfhYGlYrQC IaRnB1xCW4woFYxa+SA5ybqbPBG04WyEJKUFBGVAoSoANzPsrkpEvdkcugQ4tkiD0I0V ReaKB/iJKcmi7wozNdfEDMZeA7ZvO1MXvODJ1aeI8WxsKAEnTGYxkJmBAOERSZf0DOvz u5lbBsT546m8oekpFskYsypfDr/TG77BmrNsNFcIjB+FWzeP/PPXZT0GD0Iwn6dRyCPu F25g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WX6GDNzN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a42si3838927edf.535.2020.10.28.04.49.50; Wed, 28 Oct 2020 04:50:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WX6GDNzN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1794524AbgJ0PMP (ORCPT + 99 others); Tue, 27 Oct 2020 11:12:15 -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