Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] sys_set_mempolicy() doesnt check if mode < 0

A kernel BUG() is triggered by a call to set_mempolicy() with a negative
first argument. This is because the mode is declared as an int, and the
validity check doesnt check < 0 values. Alternatively, mode could be
declared as unsigned int or unsigned long.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Eric Dumazet and committed by
Linus Torvalds
ba17101b 690dbe1c

+1 -1
+1 -1
mm/mempolicy.c
··· 443 443 struct mempolicy *new; 444 444 DECLARE_BITMAP(nodes, MAX_NUMNODES); 445 445 446 - if (mode > MPOL_MAX) 446 + if (mode < 0 || mode > MPOL_MAX) 447 447 return -EINVAL; 448 448 err = get_nodes(nodes, nmask, maxnode, mode); 449 449 if (err)