[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240126132240.24518-1-luochunsheng@ustc.edu>
Date: Fri, 26 Jan 2024 08:22:40 -0500
From: Chunsheng Luo <luochunsheng@...c.edu>
To: akpm@...ux-foundation.org
Cc: linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Chunsheng Luo <luochunsheng@...c.edu>
Subject: [PATCH] mempolicy: check home_node is in the nodes of policy
set_mempolicy_home_node should be used after setting the memory
policy. If the home_node isn't in the nodes of policy, we should
return failure to avoid misunderstanding.
Signed-off-by: Chunsheng Luo <luochunsheng@...c.edu>
---
mm/mempolicy.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 10a590ee1c89..9282be2ae18e 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1536,6 +1536,12 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le
err = -EOPNOTSUPP;
break;
}
+
+ if (!node_isset(home_node, old->nodes)) {
+ err = -EINVAL;
+ break;
+ }
+
new = mpol_dup(old);
if (IS_ERR(new)) {
err = PTR_ERR(new);
--
2.43.0
Powered by blists - more mailing lists