[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tencent_65B128564B40DAFEBCBF06F8E2011BC32407@qq.com>
Date: Mon, 19 Aug 2024 22:54:16 +0800
From: jiping huang <huangjiping95@...com>
To: akpm@...ux-foundation.org
Cc: linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
jiping huang <huangjiping95@...com>
Subject: [PATCH] mm: Avoid a risk of null pointer.
There is a probability that we will get a null pointer when we use
find_vm() interface.
Signed-off-by: jiping huang <huangjiping95@...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
Powered by blists - more mailing lists