public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for 2.6.15] Make sure interleave masks have at least one node set
@ 2006-01-02 23:07 Andi Kleen
  0 siblings, 0 replies; only message in thread
From: Andi Kleen @ 2006-01-02 23:07 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel


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: Andi Kleen <ak@suse.de>

Index: linux-2.6.15rc7-work/mm/mempolicy.c
===================================================================
--- linux-2.6.15rc7-work.orig/mm/mempolicy.c
+++ linux-2.6.15rc7-work/mm/mempolicy.c
@@ -161,6 +161,10 @@ static struct mempolicy *mpol_new(int mo
 	switch (mode) {
 	case MPOL_INTERLEAVE:
 		policy->v.nodes = *nodes;
+		if (nodes_weight(*nodes) == 0) {
+			kmem_cache_free(policy_cache, policy);
+			return ERR_PTR(-EINVAL);
+		}
 		break;
 	case MPOL_PREFERRED:
 		policy->v.preferred_node = first_node(*nodes);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-02 23:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-02 23:07 [PATCH for 2.6.15] Make sure interleave masks have at least one node set Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox