diff options
author | Tom Murphy <murphyt7@tcd.ie> | 2020-09-10 15:25:38 +0300 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2020-09-18 18:13:21 +0300 |
commit | b34e9b0de3c4117e70f09ae354d763cc4dd85bdf (patch) | |
tree | 5dddaa32a833252e65aee011be02ae75c24d244a /drivers | |
parent | ba328f82613260a098de7b4aff58743cd8733507 (diff) | |
download | linux-b34e9b0de3c4117e70f09ae354d763cc4dd85bdf.tar.xz |
iommu/dma: Handle init_iova_flush_queue() failure in dma-iommu path
The init_iova_flush_queue() function can fail if we run out of memory. Fall
back to noflush queue if it fails.
Signed-off-by: Tom Murphy <murphyt7@tcd.ie>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20200910122539.3662-1-murphyt7@tcd.ie
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/iommu/dma-iommu.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 79b4d1073dcb..cd6e3c70ebb3 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -343,8 +343,11 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base, if (!cookie->fq_domain && !iommu_domain_get_attr(domain, DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE, &attr) && attr) { - cookie->fq_domain = domain; - init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, NULL); + if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, + NULL)) + pr_warn("iova flush queue initialization failed\n"); + else + cookie->fq_domain = domain; } if (!dev) |