linux/arch
Petr Pavlu aa3e1ba32e
riscv: Fix a number of free'd resources in init_resources()
Function init_resources() allocates a boot memory block to hold an array of
resources which it adds to iomem_resource. The array is filled in from its
end and the function then attempts to free any unused memory at the
beginning. The problem is that size of the unused memory is incorrectly
calculated and this can result in releasing memory which is in use by
active resources. Their data then gets corrupted later when the memory is
reused by a different part of the system.

Fix the size of the released memory to correctly match the number of unused
resource entries.

Fixes: ffe0e52612 ("RISC-V: Improve init_resources()")
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Nick Kossifidis <mick@ics.forth.gr>
Tested-by: Sunil V L <sunilvl@ventanamicro.com>
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
2021-08-20 10:15:51 -07:00
..
alpha Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
arc Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
arm Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
arm64 Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
csky Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
h8300 Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
hexagon Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
ia64 Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
m68k Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
microblaze Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
mips Two fixes: 2021-07-11 11:17:57 -07:00
nds32 Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
nios2 Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
openrisc Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
parisc Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
powerpc Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
riscv riscv: Fix a number of free'd resources in init_resources() 2021-08-20 10:15:51 -07:00
s390 Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
sh Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
sparc Locking fixes: 2021-07-11 11:06:09 -07:00
um Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
x86 A fix and a hardware-enablement addition: 2021-07-11 11:10:48 -07:00
xtensa Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
.gitignore
Kconfig Kconfig: Introduce ARCH_WANTS_NO_INSTR and CC_HAS_NO_PROFILE_FN_ATTR 2021-06-22 11:07:18 -07:00