Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f62d09e5 authored by Catalin Marinas's avatar Catalin Marinas Committed by Sami Tolvanen
Browse files

UPSTREAM: arm64: Fix section mismatch on alloc_init_p[mu]d()



Commit 523d6e9fae93 (arm64:mm: free the useless initial page table)
introduced a BUG_ON checking for the allocation type but it was
referring the early_alloc() function in the __init section. This patch
changes the check to slab_is_available() and also relaxes the BUG to a
WARN_ON_ONCE.

Reported-by: default avatarWill Deacon <will.deacon@arm.com>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>

Bug: 31432001
Change-Id: I5e6f9d083dc0cb6f2ba89b20353be2d479182103
(cherry picked from commit 41089357e1874559458f672b9591436ffd3a12e9)
Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>
parent 76c8e954
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <linux/memblock.h>
#include <linux/fs.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/stop_machine.h>

#include <asm/cputype.h>
@@ -157,7 +158,7 @@ static void alloc_init_pmd(struct mm_struct *mm, pud_t *pud,
				flush_tlb_all();
				if (pmd_table(old_pmd)) {
					phys_addr_t table = __pa(pte_offset_map(&old_pmd, 0));
					BUG_ON(alloc != early_alloc);
					if (!WARN_ON_ONCE(slab_is_available()))
						memblock_free(table, PAGE_SIZE);
				}
			}
@@ -218,7 +219,7 @@ static void alloc_init_pud(struct mm_struct *mm, pgd_t *pgd,
				flush_tlb_all();
				if (pud_table(old_pud)) {
					phys_addr_t table = __pa(pmd_offset(&old_pud, 0));
					BUG_ON(alloc != early_alloc);
					if (!WARN_ON_ONCE(slab_is_available()))
						memblock_free(table, PAGE_SIZE);
				}
			}