WSL2-Linux-Kernel/arch/arm64/mm
Dave P Martin b9bcc91993 arm64: mm: Fix freeing of the wrong memmap entries with !SPARSEMEM_VMEMMAP
The memmap freeing code in free_unused_memmap() computes the end of
each memblock by adding the memblock size onto the base.  However,
if SPARSEMEM is enabled then the value (start) used for the base
may already have been rounded downwards to work out which memmap
entries to free after the previous memblock.

This may cause memmap entries that are in use to get freed.

In general, you're not likely to hit this problem unless there
are at least 2 memblocks and one of them is not aligned to a
sparsemem section boundary.  Note that carve-outs can increase
the number of memblocks by splitting the regions listed in the
device tree.

This problem doesn't occur with SPARSEMEM_VMEMMAP, because the
vmemmap code deals with freeing the unused regions of the memmap
instead of requiring the arch code to do it.

This patch gets the memblock base out of the memblock directly when
computing the block end address to ensure the correct value is used.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2015-06-17 14:29:34 +01:00
..
Makefile arm64: use fixmap region for permanent FDT mapping 2015-06-02 16:31:33 +01:00
cache.S arm64: alternative: Merge alternative-asm.h into alternative.h 2015-06-05 10:38:53 +01:00
context.c arm64: Do not attempt to use init_mm in reset_context() 2015-06-12 15:36:18 +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-04-29 17:39:39 +01:00
dump.c arm64: mm: Fix build error with CONFIG_SPARSEMEM_VMEMMAP disabled 2015-05-05 12:22:17 +01:00
extable.c arm64: MMU fault handling and page table management 2012-09-17 13:41:57 +01:00
fault.c arm64: move to ESR_ELx macros 2015-01-15 12:24:15 +00:00
flush.c arm64: kill flush_cache_all() 2015-05-19 15:27:42 +01:00
hugetlbpage.c mm/hugetlb: reduce arch dependent code around follow_huge_* 2015-02-11 17:06:01 -08:00
init.c arm64: mm: Fix freeing of the wrong memmap entries with !SPARSEMEM_VMEMMAP 2015-06-17 14:29:34 +01:00
ioremap.c arm64: add ioremap physical address information 2015-01-23 15:29:06 +00:00
mm.h arm64: add better page protections to arm64 2015-01-22 14:54:29 +00:00
mmap.c mm: expose arch_mmap_rnd when available 2015-04-14 16:49:05 -07:00
mmu.c arm64: use fixmap region for permanent FDT mapping 2015-06-02 16:31:33 +01:00
pageattr.c arm64: mm: unexport set_memory_ro and set_memory_rw 2015-03-19 10:43:56 +00:00
pgd.c arm64: pgalloc: consistently use PGALLOC_GFP 2014-11-20 12:05:18 +00:00
proc-macros.S arm64: mm: increase VA range of identity map 2015-03-23 11:35:29 +00:00
proc.S arm64: kill flush_cache_all() 2015-05-19 15:27:42 +01:00