* [PATCH] mm: Avoid a risk of null pointer.
@ 2024-08-19 14:54 jiping huang
0 siblings, 0 replies; only message in thread
From: jiping huang @ 2024-08-19 14:54 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, linux-kernel, jiping huang
There is a probability that we will get a null pointer when we use
find_vm() interface.
Signed-off-by: jiping huang <huangjiping95@qq.com>
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index aec756ae5637..a0bcc1865c62 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -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
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-08-19 14:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-19 14:54 [PATCH] mm: Avoid a risk of null pointer jiping huang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox