ARM: dma-mapping: don't allow DMA mappings to be marked executable 33/154633/1
authorRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 23 Oct 2013 15:14:59 +0000 (16:14 +0100)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 11 Oct 2017 01:48:40 +0000 (10:48 +0900)
DMA mapping permissions were being derived from pgprot_kernel directly
without using PAGE_KERNEL.  This causes them to be marked with executable
permission, which is not what we want.  Fix this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
[sw0312.kim: cherry-pick from mainline to fix CVE-2014-9888]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I2091a256d8ceba7b0f2508e8c354e7064777e503

arch/arm/mm/dma-mapping.c

index bbf2d58..55770cf 100644 (file)
@@ -670,7 +670,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
                    gfp_t gfp, struct dma_attrs *attrs)
 {
-       pgprot_t prot = __get_dma_pgprot(attrs, pgprot_kernel);
+       pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL);
        void *memory;
 
        if (dma_alloc_from_coherent(dev, size, handle, &memory))
@@ -683,7 +683,7 @@ void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 static void *arm_coherent_dma_alloc(struct device *dev, size_t size,
        dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs)
 {
-       pgprot_t prot = __get_dma_pgprot(attrs, pgprot_kernel);
+       pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL);
        void *memory;
 
        if (dma_alloc_from_coherent(dev, size, handle, &memory))