提交 cb216b84 编写于 作者: R Robin Murphy 提交者: Christoph Hellwig

swiotlb: Skip cache maintenance on map error

If swiotlb_bounce_page() failed, calling arch_sync_dma_for_device() may
lead to such delights as performing cache maintenance on whatever
address phys_to_virt(SWIOTLB_MAP_ERROR) looks like, which is typically
outside the kernel memory map and goes about as well as expected.

Don't do that.

Fixes: a4a4330d ("swiotlb: add support for non-coherent DMA")
Tested-by: NJohn Stultz <john.stultz@linaro.org>
Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
上级 b3408715
...@@ -679,7 +679,8 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, ...@@ -679,7 +679,8 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
} }
if (!dev_is_dma_coherent(dev) && if (!dev_is_dma_coherent(dev) &&
(attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0) (attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0 &&
dev_addr != DIRECT_MAPPING_ERROR)
arch_sync_dma_for_device(dev, phys, size, dir); arch_sync_dma_for_device(dev, phys, size, dir);
return dev_addr; return dev_addr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册