acrn-kernel/arch/riscv/kernel
Geert Uytterhoeven ce989f1472
RISC-V: Fix out-of-bounds accesses in init_resources()
init_resources() allocates an array of resources, based on the current
total number of memory regions and reserved memory regions.  However,
allocating this array using memblock_alloc() might increase the number
of reserved memory regions.  If that happens, populating the array later
based on the new number of regions will cause out-of-bounds writes
beyond the end of the allocated array.

Fix this by allocating one more entry, which may or may not be used.

Fixes: 797f0375dd ("RISC-V: Do not allocate memblock while iterating reserved memblocks")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
2021-03-16 21:55:11 -07:00
..
probes ftrace: Fix spelling mistake "disabed" -> "disabled" 2021-03-16 21:19:40 -07:00
vdso riscv: Disable KSAN_SANITIZE for vDSO 2021-02-22 17:51:23 -08:00
.gitignore
Makefile riscv: syscall_table: Reduce W=1 compilation warnings noise 2021-03-09 20:46:04 -08:00
asm-offsets.c riscv: Enable per-task stack canaries 2021-01-14 15:09:10 -08:00
cacheinfo.c
cpu-hotplug.c
cpu.c
cpu_ops.c
cpu_ops_sbi.c
cpu_ops_spinwait.c
cpufeature.c
efi-header.S
efi.c
entry.S
fpu.S
ftrace.c riscv: Using PATCHABLE_FUNCTION_ENTRY instead of MCOUNT 2021-01-14 15:09:05 -08:00
head.S riscv: add BUILTIN_DTB support for MMU-enabled targets 2021-02-18 23:17:54 -08:00
head.h
image-vars.h arch/riscv:fix typo in a comment in arch/riscv/kernel/image-vars.h 2021-02-18 23:18:00 -08:00
irq.c
jump_label.c
kgdb.c
mcount-dyn.S riscv: Using PATCHABLE_FUNCTION_ENTRY instead of MCOUNT 2021-01-14 15:09:05 -08:00
mcount.S
module-sections.c
module.c
patch.c riscv: Fixup compile error BUILD_BUG_ON failed 2021-01-14 15:09:01 -08:00
perf_callchain.c
perf_event.c
perf_regs.c
process.c riscv: process: Fix no prototype for show_regs 2021-03-09 20:46:05 -08:00
ptrace.c RISC-V: Implement ptrace regs and stack API 2021-01-14 15:09:01 -08:00
reset.c
riscv_ksyms.c
sbi.c riscv: sbi: Fix comment of __sbi_set_timer_v01 2021-03-09 20:46:01 -08:00
setup.c RISC-V: Fix out-of-bounds accesses in init_resources() 2021-03-16 21:55:11 -07:00
signal.c riscv: Add uprobes supported 2021-01-14 15:09:08 -08:00
smp.c
smpboot.c riscv: Add numa support for riscv64 platform 2021-01-14 15:08:58 -08:00
soc.c
stacktrace.c RISC-V Patches for the 5.12 Merge Window 2021-02-26 10:28:35 -08:00
sys_riscv.c
syscall_table.c
time.c riscv: time: Fix no prototype for time_init 2021-03-09 20:46:03 -08:00
traps.c riscv: traps: Fix no prototype warnings 2021-03-09 20:45:51 -08:00
traps_misaligned.c
vdso.c
vmlinux.lds.S