From c2c896bee08e1461fc24f9bf7dd57e2c63f6db70 Mon Sep 17 00:00:00 2001 From: Arseny Solokha Date: Wed, 4 Feb 2015 13:18:02 +1100 Subject: [PATCH] powerpc/mm: Warn on flushing tlb page in kernel context Function __flush_tlb_page() must only be called for user contexts, so put in extra hardening to warn on calling it for kernel context. Signed-off-by: Arseny Solokha Signed-off-by: Michael Ellerman --- arch/powerpc/mm/tlb_nohash.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c index ab0616b0e6c2..cbd3d069897f 100644 --- a/arch/powerpc/mm/tlb_nohash.c +++ b/arch/powerpc/mm/tlb_nohash.c @@ -284,7 +284,11 @@ void __flush_tlb_page(struct mm_struct *mm, unsigned long vmaddr, struct cpumask *cpu_mask; unsigned int pid; - if (unlikely(!mm)) + /* + * This function as well as __local_flush_tlb_page() must only be called + * for user contexts. + */ + if (unlikely(WARN_ON(!mm))) return; preempt_disable(); -- 2.20.1