summaryrefslogtreecommitdiffstats
path: root/arch/openrisc/kernel/smp.c
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2021-11-03 12:19:33 +0100
committerStafford Horne <shorne@gmail.com>2021-11-03 12:48:29 +0100
commit27dff9a9c247d4e38d82c2e7234914cfe8499294 (patch)
tree25dc698f51b2c05aab8f0666996035994ec83878 /arch/openrisc/kernel/smp.c
parentopenrisc: signal: remove unused DEBUG_SIG macro (diff)
downloadlinux-27dff9a9c247d4e38d82c2e7234914cfe8499294.tar.xz
linux-27dff9a9c247d4e38d82c2e7234914cfe8499294.zip
openrisc: fix SMP tlb flush NULL pointer dereference
Throughout the OpenRISC kernel port VMA is passed as NULL when flushing kernel tlb entries. Somehow this was missed when I was testing c28b27416da9 ("openrisc: Implement proper SMP tlb flushing") and now the SMP kernel fails to completely boot. In OpenRISC VMA is used only to determine which cores need to have their TLB entries flushed. This patch updates the logic to flush tlbs on all cores when the VMA is passed as NULL. Also, we update places VMA is passed as NULL to use flush_tlb_kernel_range instead. Now, the only place VMA is passed as NULL is in the implementation of flush_tlb_kernel_range. Fixes: c28b27416da9 ("openrisc: Implement proper SMP tlb flushing") Reported-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> Signed-off-by: Stafford Horne <shorne@gmail.com>
Diffstat (limited to 'arch/openrisc/kernel/smp.c')
-rw-r--r--arch/openrisc/kernel/smp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c
index 415e209732a3..ba78766cf00b 100644
--- a/arch/openrisc/kernel/smp.c
+++ b/arch/openrisc/kernel/smp.c
@@ -272,7 +272,7 @@ static inline void ipi_flush_tlb_range(void *info)
local_flush_tlb_range(NULL, fd->addr1, fd->addr2);
}
-static void smp_flush_tlb_range(struct cpumask *cmask, unsigned long start,
+static void smp_flush_tlb_range(const struct cpumask *cmask, unsigned long start,
unsigned long end)
{
unsigned int cpuid;
@@ -320,7 +320,9 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
void flush_tlb_range(struct vm_area_struct *vma,
unsigned long start, unsigned long end)
{
- smp_flush_tlb_range(mm_cpumask(vma->vm_mm), start, end);
+ const struct cpumask *cmask = vma ? mm_cpumask(vma->vm_mm)
+ : cpu_online_mask;
+ smp_flush_tlb_range(cmask, start, end);
}
/* Instruction cache invalidate - performed on each cpu */