[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190312091637.16412-1-yuehaibing@huawei.com>
Date: Tue, 12 Mar 2019 17:16:37 +0800
From: Yue Haibing <yuehaibing@...wei.com>
To: <linux@...linux.org.uk>, <akpm@...ux-foundation.org>,
<robin.murphy@....com>, <iamjoonsoo.kim@....com>, <hch@....de>
CC: <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
YueHaibing <yuehaibing@...wei.com>
Subject: [PATCH] ARM: dma-mapping: always clear allocated buffers in __alloc_from_pool
From: YueHaibing <yuehaibing@...wei.com>
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.
Signed-off-by: YueHaibing <yuehaibing@...wei.com>
---
arch/arm/mm/dma-mapping.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 8a90f29..28ad6d5 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -558,6 +558,7 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page)
*ret_page = phys_to_page(phys);
ptr = (void *)val;
+ memset(ptr, 0, size);
}
return ptr;
--
2.7.0
Powered by blists - more mailing lists