linux/arch/arm64/mm
Dean Nelson 0df938e720 arm64: add missing PAGE_ALIGN() to __dma_free()
commit 2cff98b99c upstream.

__dma_alloc() does a PAGE_ALIGN() on the passed in size argument before
doing anything else. __dma_free() does not. And because it doesn't, it is
possible to leak memory should size not be an integer multiple of PAGE_SIZE.

The solution is to add a PAGE_ALIGN() to __dma_free() like is done in
__dma_alloc().

Additionally, this patch removes a redundant PAGE_ALIGN() from
__dma_alloc_coherent(), since __dma_alloc_coherent() can only be called
from __dma_alloc(), which already does a PAGE_ALIGN() before the call.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Dean Nelson <dnelson@redhat.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
[ luis: backported to 3.16: based on Dean's 3.19 backport ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
History 2015-05-28 10:53:16 +01:00
..
cache.S arm64: mm: use inner-shareable barriers for inner-shareable maintenance 2014-05-09 17:21:24 +01:00
context.c arm64: Process management 2012-09-17 13:41:58 +01:00
copypage.c arm64: export __cpu_{clear,copy}_user_page functions 2014-07-08 17:30:51 +01:00
dma-mapping.c arm64: add missing PAGE_ALIGN() to __dma_free() 2015-05-28 10:53:16 +01:00
extable.c arm64: MMU fault handling and page table management 2012-09-17 13:41:57 +01:00
fault.c Revert "arm64: Introduce execute-only page access permissions" 2014-05-16 16:44:32 +01:00
flush.c arm64: mm: Make icache synchronisation logic huge page aware 2014-07-04 14:26:01 +01:00
hugetlbpage.c hugetlb: restrict hugepage_migration_support() to x86_64 2014-06-04 16:53:51 -07:00
init.c arm64: Create non-empty ZONE_DMA when DRAM starts above 4GB 2014-07-23 11:23:58 +01:00
ioremap.c arm64: add early_ioremap support 2014-04-07 16:36:15 -07:00
Makefile arm64: mm: Optimise tlb flush logic where we have >4K granule 2014-05-09 17:00:48 +01:00
mm.h arm64: Remove __flush_dcache_page() 2013-06-07 17:58:30 +01:00
mmap.c arm64/mm: Remove hack in mmap randomize layout 2015-05-20 13:26:23 +01:00
mmu.c - Optimised assembly string/memory routines (based on the AArch64 Cortex 2014-06-06 10:43:28 -07:00
pgd.c arm64: simplify pgd_alloc 2014-02-05 10:45:07 +00:00
proc-macros.S arm64: mm: use ubfm for dcache_line_size 2014-01-22 16:23:58 +00:00
proc.S arm64: mm: use inner-shareable barriers for inner-shareable maintenance 2014-05-09 17:21:24 +01:00