Re: [PATCH] ARM: dma-mapping: always clear allocated buffers in __alloc_from_pool

From: Christoph Hellwig
Date: Wed Mar 13 2019 - 14:29:11 EST


On Tue, Mar 12, 2019 at 05:16:37PM +0800, Yue Haibing wrote:
> From: YueHaibing <yuehaibing@xxxxxxxxxx>
>
> Like commit 518a2f1925c3 ("dma-mapping: zero memory returned
> from dma_alloc_*"), if we want to map memory from the DMA
> allocator to userspace it must be zeroed at allocation time
> to prevent stale data leaks. On arm platform, if the allocator
> is pool_allocator in __dma_alloc, then the mem is alloced by
> __alloc_from_pool, which also need be zeroed.

The observations looks correct, and because this memory is already
remapped I don't think we need __dma_clear_buffer here.

But I'd love to see a review from Russell as well.