hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I963VJ CVE: NA
-------------------------------
If preferred_nmask is invalid, it should not to modify memory policy for the task.
Signed-off-by: Hui Tang tanghui20@huawei.com --- kernel/sched/grid/qos.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/grid/qos.c b/kernel/sched/grid/qos.c index f0f10dfb9fd4..730ca90c8f85 100644 --- a/kernel/sched/grid/qos.c +++ b/kernel/sched/grid/qos.c @@ -84,7 +84,8 @@ int sched_grid_preferred_interleave_nid(struct mempolicy *policy) preferred_nmask = &me->grid_qos->affinity.mem_preferred_node_mask;
- if (!preferred_nmask || !policy) + if (!preferred_nmask || !policy || nodes_empty(*preferred_nmask) || + nodes_equal(*preferred_nmask, node_online_map)) return NUMA_NO_NODE;
if (nodes_equal(policy->v.nodes, *preferred_nmask)) @@ -115,7 +116,8 @@ int sched_grid_preferred_nid(int preferred_nid, nodemask_t *nodemask) preferred_nmask = ¤t->grid_qos->affinity.mem_preferred_node_mask;
- if (!preferred_nmask) + if (!preferred_nmask || nodes_empty(*preferred_nmask) || + nodes_equal(*preferred_nmask, node_online_map)) return preferred_nid;
/*