Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932486AbWB0WmH (ORCPT ); Mon, 27 Feb 2006 17:42:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932354AbWB0Wb1 (ORCPT ); Mon, 27 Feb 2006 17:31:27 -0500 Received: from 216-99-217-87.dsl.aracnet.com ([216.99.217.87]:52608 "EHLO sorel.sous-sol.org") by vger.kernel.org with ESMTP id S1751760AbWB0WbG (ORCPT ); Mon, 27 Feb 2006 17:31:06 -0500 Message-Id: <20060227223350.609924000@sorel.sous-sol.org> References: <20060227223200.865548000@sorel.sous-sol.org> Date: Mon, 27 Feb 2006 14:32:18 -0800 From: Chris Wright To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , torvalds@osdl.org, akpm@osdl.org, alan@lxorguk.ukuu.org.uk, Andi Kleen , Greg Kroah-Hartman Subject: [patch 18/39] [PATCH] sys_mbind sanity checking Content-Disposition: inline; filename=sys_mbind-sanity-checking.patch Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1037 Lines: 34 -stable review patch. If anyone has any objections, please let us know. ------------------ Make sure maxnodes is safe size before calculating nlongs in get_nodes(). Signed-off-by: Chris Wright Signed-off-by: Linus Torvalds [chrisw: fix units, pointed out by Andi] Cc: Andi Kleen Signed-off-by: Greg Kroah-Hartman --- mm/mempolicy.c | 2 ++ 1 files changed, 2 insertions(+) --- linux-2.6.15.4.orig/mm/mempolicy.c +++ linux-2.6.15.4/mm/mempolicy.c @@ -524,6 +524,8 @@ static int get_nodes(nodemask_t *nodes, nodes_clear(*nodes); if (maxnode == 0 || !nmask) return 0; + if (maxnode > PAGE_SIZE*BITS_PER_BYTE) + return -EINVAL; nlongs = BITS_TO_LONGS(maxnode); if ((maxnode % BITS_PER_LONG) == 0) -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/