linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mempolicy: check home_node is in the nodes of policy
@ 2024-01-26 13:22 Chunsheng Luo
  2024-01-28  8:29 ` Andrew Morton
  2024-01-29 15:12 ` Gregory Price
  0 siblings, 2 replies; 6+ messages in thread
From: Chunsheng Luo @ 2024-01-26 13:22 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, Chunsheng Luo

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@ustc.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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-30  4:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-26 13:22 [PATCH] mempolicy: check home_node is in the nodes of policy Chunsheng Luo
2024-01-28  8:29 ` Andrew Morton
2024-01-29  6:15   ` ustc
2024-01-29 15:12 ` Gregory Price
2024-01-30  2:29   ` Chunsheng Luo
2024-01-30  4:02     ` Chunsheng Luo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).