Skip to contentSkip to conversation

mm: Avoid a risk of null pointer.

PATCH New jiping huang 1 participant 1 message Aug 19, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: Avoid a risk of null pointer.

There is a probability that we will get a null pointer when we use find_vm() interface.

mm/mempolicy.c +5 -0
index aec756ae5637..a0bcc1865c62 100644
@@ -1079,6 +1079,11 @@ static long migrate_to_node(struct mm_struct *mm, int source, int dest,
 	mmap_read_lock(mm);
 	vma = find_vma(mm, 0);
 
+	if (!vma) {
+		mmap_read_unlock(mm);
+		return -EFAULT;
+	}
+
 	/*
 	 * This does not migrate the range, but isolates all pages that
 	 * need migration.  Between passing in the full user address
Signature · 1 line
2.34.1