Skip to content

Commit 3238c35

Browse files
rmurphy-armctmarinas
authored andcommitted
arm64: dma-mapping: Fix FORCE_CONTIGUOUS buffer clearing
We need to invalidate the caches *before* clearing the buffer via the non-cacheable alias, else in the worst case __dma_flush_area() may write back dirty lines over the top of our nice new zeros. Fixes: dd65a94 ("arm64: dma-mapping: clear buffers allocated with FORCE_CONTIGUOUS flag") Cc: <stable@vger.kernel.org> # 4.18.x- Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 40e020c commit 3238c35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/mm/dma-mapping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,9 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size,
429429
prot,
430430
__builtin_return_address(0));
431431
if (addr) {
432-
memset(addr, 0, size);
433432
if (!coherent)
434433
__dma_flush_area(page_to_virt(page), iosize);
434+
memset(addr, 0, size);
435435
} else {
436436
iommu_dma_unmap_page(dev, *handle, iosize, 0, attrs);
437437
dma_release_from_contiguous(dev, page,

0 commit comments

Comments
 (0)