[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190411184741.27540-10-tmurphy@arista.com>
Date: Thu, 11 Apr 2019 19:47:38 +0100
From: Tom Murphy <tmurphy@...sta.com>
To: iommu@...ts.linux-foundation.org
Cc: dima@...sta.com, jamessewart@...sta.com, murphyt7@....ie,
Tom Murphy <tmurphy@...sta.com>,
Joerg Roedel <joro@...tes.org>,
Will Deacon <will.deacon@....com>,
Robin Murphy <robin.murphy@....com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Kukjin Kim <kgene@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Rob Clark <robdclark@...il.com>,
Andy Gross <andy.gross@...aro.org>,
David Brown <david.brown@...aro.org>,
Heiko Stuebner <heiko@...ech.de>,
Thomas Gleixner <tglx@...utronix.de>,
Marc Zyngier <marc.zyngier@....com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org,
linux-mediatek@...ts.infradead.org, linux-arm-msm@...r.kernel.org,
linux-rockchip@...ts.infradead.org
Subject: [PATCH 9/9] iommu/amd: Add allocated domain to global list earlier
dma_ops_domain_free() expects domain to be in a global list.
Arguably, could be called before protection_domain_init().
Signed-off-by: Dmitry Safonov <dima@...sta.com>
Signed-off-by: Tom Murphy <tmurphy@...sta.com>
---
drivers/iommu/amd_iommu.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 02b351834a3b..bfb021d656aa 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1801,8 +1801,12 @@ static struct protection_domain *dma_ops_domain_alloc(void)
if (!domain)
return NULL;
- if (protection_domain_init(domain))
- goto free_domain;
+ if (protection_domain_init(domain)) {
+ kfree(domain);
+ return NULL;
+ }
+
+ add_domain_to_list(domain);
domain->mode = PAGE_MODE_3_LEVEL;
domain->pt_root = (void *)get_zeroed_page(GFP_KERNEL);
@@ -1824,8 +1828,6 @@ static struct protection_domain *dma_ops_domain_alloc(void)
/* Initialize reserved ranges */
iommu_dma_copy_reserved_iova(&reserved_iova_ranges, &domain->domain);
- add_domain_to_list(domain);
-
return domain;
free_cookie:
--
2.17.1
Powered by blists - more mailing lists