Commit 920e3328 authored by Randy Dunlap's avatar Randy Dunlap Committed by Linus Torvalds

[PATCH] cpumask: range check before using value

When setting the 'cpu_isolated_map' mask, check that the user input value
is valid (in range 0 ..  NR_CPUS - 1).  Also fix up kernel-parameters.txt
for this parameter.
Signed-off-by: default avatarRandy Dunlap <rddunlap@osdl.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 68764ad9
......@@ -587,11 +587,13 @@ running once the system is up.
Format: <RDP>, <reset>, <pci_scan>, <verbosity>
isolcpus= [KNL,SMP] Isolate CPUs from the general scheduler.
Format: <cpu number>, ..., <cpu number>
Format: <cpu number>,...,<cpu number>
This option can be used to specify one or more CPUs
to isolate from the general SMP balancing and scheduling
algorithms. The only way to move a process onto or off
an "isolated" CPU is via the CPU affinity syscalls.
<cpu number> begins at 0 and the maximum value is
"number of CPUs in system - 1".
This option is the preferred way to isolate CPUs. The
alternative - manually setting the CPU mask of all tasks
......
......@@ -36,6 +36,7 @@
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/smp.h>
#include <linux/threads.h>
#include <linux/timer.h>
#include <linux/rcupdate.h>
#include <linux/cpu.h>
......@@ -4169,7 +4170,8 @@ static int __init isolated_cpu_setup(char *str)
str = get_options(str, ARRAY_SIZE(ints), ints);
cpus_clear(cpu_isolated_map);
for (i = 1; i <= ints[0]; i++)
cpu_set(ints[i], cpu_isolated_map);
if (ints[i] < NR_CPUS)
cpu_set(ints[i], cpu_isolated_map);
return 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment