summaryrefslogtreecommitdiff
path: root/arch/sparc
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-12-14 09:00:40 +0100
committerChristoph Hellwig <hch@lst.de>2018-12-20 08:13:52 +0100
commit518a2f1925c3165befbf06b75e07636549d92c1c (patch)
tree629130481205f514709c3cc84a2f5debed28f8cd /arch/sparc
parent6c503d0d88db9d57c1dc4c87175c94766b6a6c61 (diff)
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. We already do this on most common architectures, but some architectures don't do this yet, fix them up, either by passing GFP_ZERO when we use the normal page allocator or doing a manual memset otherwise. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> [m68k] Acked-by: Sam Ravnborg <sam@ravnborg.org> [sparc]
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/kernel/ioport.c2
-rw-r--r--arch/sparc/mm/io-unit.c2
-rw-r--r--arch/sparc/mm/iommu.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index baa235652c27..f89603855f1e 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -325,7 +325,7 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
return NULL;
size = PAGE_ALIGN(size);
- va = (void *) __get_free_pages(gfp, get_order(size));
+ va = (void *) __get_free_pages(gfp | __GFP_ZERO, get_order(size));
if (!va) {
printk("%s: no %zd pages\n", __func__, size >> PAGE_SHIFT);
return NULL;
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index 91be13935d40..f770ee7229d8 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -224,7 +224,7 @@ static void *iounit_alloc(struct device *dev, size_t len,
return NULL;
len = PAGE_ALIGN(len);
- va = __get_free_pages(gfp, get_order(len));
+ va = __get_free_pages(gfp | __GFP_ZERO, get_order(len));
if (!va)
return NULL;
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index fb771a634452..e8d5d73ca40d 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -344,7 +344,7 @@ static void *sbus_iommu_alloc(struct device *dev, size_t len,
return NULL;
len = PAGE_ALIGN(len);
- va = __get_free_pages(gfp, get_order(len));
+ va = __get_free_pages(gfp | __GFP_ZERO, get_order(len));
if (va == 0)
return NULL;