On 09/12/2019 12:38 pm, Jean-Philippe Brucker wrote:
Since commit 781ca2de89ba ("iommu: Add gfp parameter to
iommu_ops::map"), iommu_map() might sleep. iommu_dma_get_msi_page() runs
in atomic context and thus should call iommu_map_atomic() instead.

Spooky... I'm rebasing my local branches and this arrived at the exact moment I came across my fix[1] that I'd otherwise forgotten about. As covered there, this really doesn't need to be atomic at all now, so I'd prefer to see it cleaned up more thoroughly.

Robin.

[1] https://lore.kernel.org/linux-iommu/5af5e77102ca52576cb96816f0abcf6398820055.1571245656.git.robin.mur...@arm.com/

Fixes: 781ca2de89ba ("iommu: Add gfp parameter to iommu_ops::map")
Signed-off-by: Jean-Philippe Brucker <[email protected]>
---
  drivers/iommu/dma-iommu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 0cc702a70a96..f5add956641d 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -1184,7 +1184,7 @@ static struct iommu_dma_msi_page 
*iommu_dma_get_msi_page(struct device *dev,
        if (!iova)
                goto out_free_page;
- if (iommu_map(domain, iova, msi_addr, size, prot))
+       if (iommu_map_atomic(domain, iova, msi_addr, size, prot))
                goto out_free_iova;
INIT_LIST_HEAD(&msi_page->list);

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to