提交 8f493d79 编写于 作者: A Andi Kleen 提交者: Linus Torvalds

[PATCH] Make sure interleave masks have at least one node set

Otherwise a bad mem policy system call can confuse the interleaving
code into referencing undefined nodes.

Originally reported by Doug Chapman

I was told it's CVE-2005-3358
(one has to love these security people - they make everything sound important)
Signed-off-by: NAndi Kleen <ak@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 abe842eb
...@@ -161,6 +161,10 @@ static struct mempolicy *mpol_new(int mode, nodemask_t *nodes) ...@@ -161,6 +161,10 @@ static struct mempolicy *mpol_new(int mode, nodemask_t *nodes)
switch (mode) { switch (mode) {
case MPOL_INTERLEAVE: case MPOL_INTERLEAVE:
policy->v.nodes = *nodes; policy->v.nodes = *nodes;
if (nodes_weight(*nodes) == 0) {
kmem_cache_free(policy_cache, policy);
return ERR_PTR(-EINVAL);
}
break; break;
case MPOL_PREFERRED: case MPOL_PREFERRED:
policy->v.preferred_node = first_node(*nodes); policy->v.preferred_node = first_node(*nodes);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册