]> git.baikalelectronics.ru Git - kernel.git/commit
riscv: Fix config KASAN && SPARSEMEM && !SPARSE_VMEMMAP
authorAlexandre Ghiti <alexandre.ghiti@canonical.com>
Fri, 25 Feb 2022 12:39:49 +0000 (13:39 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 3 Mar 2022 21:11:30 +0000 (13:11 -0800)
commit5df3c9d30d7888038741e4e82f5b05f40a8b7076
treed79229ff688adac37205ca9118d99d7fe54e9519
parent787f194dfb45c04eb24cf3ba7c561856c81d2407
riscv: Fix config KASAN && SPARSEMEM && !SPARSE_VMEMMAP

In order to get the pfn of a struct page* when sparsemem is enabled
without vmemmap, the mem_section structures need to be initialized which
happens in sparse_init.

But kasan_early_init calls pfn_to_page way before sparse_init is called,
which then tries to dereference a null mem_section pointer.

Fix this by removing the usage of this function in kasan_early_init.

Fixes: c116cdb1b1cb ("riscv: Add KASAN support")
Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com>
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/mm/kasan_init.c