diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> | 2019-04-17 18:29:15 +0530 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2019-04-21 23:12:39 +1000 |
commit | e09093927e54323018dbb3bf6189c85a7f176bae (patch) | |
tree | 46707f04e29140d7f1213650c616277a64fa7bec /arch/powerpc/mm/hash_utils_64.c | |
parent | powerpc/mm/hash64: Map all the kernel regions in the same 0xc range (diff) | |
download | linux-dev-e09093927e54323018dbb3bf6189c85a7f176bae.tar.xz linux-dev-e09093927e54323018dbb3bf6189c85a7f176bae.zip |
powerpc/mm: Validate address values against different region limits
This adds an explicit check in various functions.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/mm/hash_utils_64.c')
-rw-r--r-- | arch/powerpc/mm/hash_utils_64.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 9c4ae4aa133e..f727197de713 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -781,9 +781,16 @@ int resize_hpt_for_hotplug(unsigned long new_mem_size) int hash__create_section_mapping(unsigned long start, unsigned long end, int nid) { - int rc = htab_bolt_mapping(start, end, __pa(start), - pgprot_val(PAGE_KERNEL), mmu_linear_psize, - mmu_kernel_ssize); + int rc; + + if (end >= H_VMALLOC_START) { + pr_warn("Outisde the supported range\n"); + return -1; + } + + rc = htab_bolt_mapping(start, end, __pa(start), + pgprot_val(PAGE_KERNEL), mmu_linear_psize, + mmu_kernel_ssize); if (rc < 0) { int rc2 = htab_remove_mapping(start, end, mmu_linear_psize, @@ -924,6 +931,11 @@ static void __init htab_initialize(void) DBG("creating mapping for region: %lx..%lx (prot: %lx)\n", base, size, prot); + if ((base + size) >= H_VMALLOC_START) { + pr_warn("Outisde the supported range\n"); + continue; + } + BUG_ON(htab_bolt_mapping(base, base + size, __pa(base), prot, mmu_linear_psize, mmu_kernel_ssize)); } |