From: jiping huang <huangjiping95@qq.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
jiping huang <huangjiping95@qq.com>
Subject: [PATCH] mm: Avoid a risk of null pointer.
Date: Mon, 19 Aug 2024 22:54:16 +0800 [thread overview]
Message-ID: <tencent_65B128564B40DAFEBCBF06F8E2011BC32407@qq.com> (raw)
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
reply other threads:[~2024-08-19 14:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_65B128564B40DAFEBCBF06F8E2011BC32407@qq.com \
--to=huangjiping95@qq.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox