linux-stable/arch
Florian Fainelli c454639172 ARM: 9216/1: Fix MAX_DMA_ADDRESS overflow
[ Upstream commit fb0fd3469e ]

Commit 26f09e9b3a ("mm/memblock: add memblock memory allocation apis")
added a check to determine whether arm_dma_zone_size is exceeding the
amount of kernel virtual address space available between the upper 4GB
virtual address limit and PAGE_OFFSET in order to provide a suitable
definition of MAX_DMA_ADDRESS that should fit within the 32-bit virtual
address space. The quantity used for comparison was off by a missing
trailing 0, leading to MAX_DMA_ADDRESS to be overflowing a 32-bit
quantity.

This was caught thanks to CONFIG_DEBUG_VIRTUAL on the bcm2711 platform
where we define a dma_zone_size of 1GB and we have a PAGE_OFFSET value
of 0xc000_0000 (CONFIG_VMSPLIT_3G) leading to MAX_DMA_ADDRESS being
0x1_0000_0000 which overflows the unsigned long type used throughout
__pa() and then __virt_addr_valid(). Because the virtual address passed
to __virt_addr_valid() would now be 0, the function would loudly warn
and flood the kernel log, thus making the platform unable to boot
properly.

Fixes: 26f09e9b3a ("mm/memblock: add memblock memory allocation apis")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-03 12:00:50 +02:00
..
alpha tty: the rest, stop using tty_schedule_flip() 2022-07-29 17:19:28 +02:00
arc ARC: entry: fix syscall_trace_exit argument 2022-04-27 13:53:55 +02:00
arm ARM: 9216/1: Fix MAX_DMA_ADDRESS overflow 2022-08-03 12:00:50 +02:00
arm64 arm64: dts: qcom: msm8992-*: Fix vdd_lvs1_2-supply typo 2022-07-12 16:32:20 +02:00
c6x
csky csky: patch_text: Fixup last cpu should be master 2022-06-09 10:21:26 +02:00
h8300
hexagon hexagon: clean up timer-regs.h 2021-11-26 10:39:19 +01:00
ia64 ia64: define get_cycles macro for arch-override 2022-05-30 09:33:40 +02:00
m68k Revert "m68knommu: only set CONFIG_ISA_DMA_API for ColdFire sub-arch" 2022-07-29 17:19:09 +02:00
microblaze uaccess: fix nios2 and microblaze get_user_8() 2022-04-08 14:40:08 +02:00
mips MIPS: Remove repetitive increase irq_err_count 2022-06-29 08:59:48 +02:00
nds32 nds32: fix access_ok() checks in get/put_user 2022-03-28 09:57:10 +02:00
nios2 nios2: use fallback for random_get_entropy() instead of zero 2022-05-30 09:33:41 +02:00
openrisc openrisc: start CPU timer early in boot 2022-06-09 10:20:55 +02:00
parisc parisc: Enable ARCH_HAS_STRICT_MODULE_RWX 2022-06-29 08:59:53 +02:00
powerpc powerpc/powernv: delay rng platform device creation until later in boot 2022-07-12 16:32:19 +02:00
riscv riscv: add as-options for modules with assembly compontents 2022-07-29 17:19:06 +02:00
s390 s390/archrandom: prevent CPACF trng invocations in interrupt context 2022-08-03 12:00:43 +02:00
sh sh: convert nommu io{re,un}map() to static inline functions 2022-07-21 21:20:02 +02:00
sparc sparc: use fallback for random_get_entropy() instead of zero 2022-05-30 09:33:42 +02:00
um um: Add missing apply_returns() 2022-07-25 11:26:55 +02:00
x86 x86/alternative: Report missing return thunk details 2022-07-29 17:19:27 +02:00
xtensa xtensa: Fix refcount leak bug in time.c 2022-06-29 08:59:53 +02:00
.gitignore
Kconfig arch/cc: Introduce a function to check for confidential computing features 2021-11-18 14:04:32 +01:00