提交 636f13c1 编写于 作者: C Chris Wright 提交者: Linus Torvalds

[PATCH] sys_mbind sanity checking

Make sure maxnodes is safe size before calculating nlongs in
get_nodes().
Signed-off-by: NChris Wright <chrisw@sous-sol.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 74910e6c
...@@ -808,6 +808,8 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask, ...@@ -808,6 +808,8 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask,
nodes_clear(*nodes); nodes_clear(*nodes);
if (maxnode == 0 || !nmask) if (maxnode == 0 || !nmask)
return 0; return 0;
if (maxnode > PAGE_SIZE)
return -EINVAL;
nlongs = BITS_TO_LONGS(maxnode); nlongs = BITS_TO_LONGS(maxnode);
if ((maxnode % BITS_PER_LONG) == 0) if ((maxnode % BITS_PER_LONG) == 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册