summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorArseny Solokha <asolokha@kb.kras.ru>2015-01-30 07:08:27 -0500
committerScott Wood <scottwood@freescale.com>2015-01-30 19:39:00 -0500
commit0dc294f717d41bfbafc746a7a96a7bc0f114c20c (patch)
treefa98880b9e87e95c9b4f94546020df14d95e36e7 /arch/powerpc/mm
parentc9111a41dc27db8a9b6c0429f4965ddd8766f620 (diff)
powerpc/mm: bail out early when flushing TLB page
MMU_NO_CONTEXT is conditionally defined as 0 or (unsigned int)-1. However, in __flush_tlb_page() a corresponding variable is only tested for open coded 0, which can cause NULL pointer dereference if `mm' argument was legitimately passed as such. Bail out early in case the first argument is NULL, thus eliminate confusion between different values of MMU_NO_CONTEXT and avoid disabling and then re-enabling preemption unnecessarily. Signed-off-by: Arseny Solokha <asolokha@kb.kras.ru> Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r--arch/powerpc/mm/tlb_nohash.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index f38ea4df6a85..ab0616b0e6c2 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -284,8 +284,11 @@ void __flush_tlb_page(struct mm_struct *mm, unsigned long vmaddr,
284 struct cpumask *cpu_mask; 284 struct cpumask *cpu_mask;
285 unsigned int pid; 285 unsigned int pid;
286 286
287 if (unlikely(!mm))
288 return;
289
287 preempt_disable(); 290 preempt_disable();
288 pid = mm ? mm->context.id : 0; 291 pid = mm->context.id;
289 if (unlikely(pid == MMU_NO_CONTEXT)) 292 if (unlikely(pid == MMU_NO_CONTEXT))
290 goto bail; 293 goto bail;
291 cpu_mask = mm_cpumask(mm); 294 cpu_mask = mm_cpumask(mm);