From: Chris Wright Date: Fri, 17 Feb 2006 21:59:36 +0000 (-0800) Subject: [PATCH] sys_mbind sanity checking X-Git-Tag: MMI-PSA29.97-13-9~51941 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=636f13c174dd7c84a437d3c3e8fa66f03f7fda63;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [PATCH] sys_mbind sanity checking Make sure maxnodes is safe size before calculating nlongs in get_nodes(). Signed-off-by: Chris Wright Signed-off-by: Linus Torvalds --- diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 323fdcf128c4..bedfa4f09c80 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -808,6 +808,8 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask, nodes_clear(*nodes); if (maxnode == 0 || !nmask) return 0; + if (maxnode > PAGE_SIZE) + return -EINVAL; nlongs = BITS_TO_LONGS(maxnode); if ((maxnode % BITS_PER_LONG) == 0)