LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm: avoid null pointer dereference in flush_tlb_mm
@ 2020-12-25  7:11 Defang Bo
  0 siblings, 0 replies; only message in thread
From: Defang Bo @ 2020-12-25  7:11 UTC (permalink / raw)
  To: mpe, benh, paulus
  Cc: linux-kernel, penberg, Defang Bo, akpm, linuxppc-dev, rppt

Similar to commit<0dc294f7>, there should be a check for 'mm' to prevent Null pointer dereference in case of 'mm' argument was legitimately passed.

Signed-off-by: Defang Bo <bodefang@126.com>
---
 arch/powerpc/mm/nohash/tlb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c
index 5872f69..09796c9 100644
--- a/arch/powerpc/mm/nohash/tlb.c
+++ b/arch/powerpc/mm/nohash/tlb.c
@@ -268,6 +268,9 @@ void flush_tlb_mm(struct mm_struct *mm)
 {
 	unsigned int pid;
 
+	if (unlikely(!mm))
+		return;
+
 	preempt_disable();
 	pid = mm->context.id;
 	if (unlikely(pid == MMU_NO_CONTEXT))
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-29 20:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-25  7:11 [PATCH] powerpc/mm: avoid null pointer dereference in flush_tlb_mm Defang Bo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox