sched/debug: Limit sd->*_idx range on sysctl
authorNamhyung Kim <namhyung.kim@lge.com>
Thu, 16 Aug 2012 08:03:24 +0000 (17:03 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Jun 2014 23:02:04 +0000 (16:02 -0700)
commit4aff95ab8f985d14f585187b5f78c65a56dd716b
treea009a89d60863d3681042a21b496c08758636b78
parent74d86ed74b4ddf37de24a9ad979a8aafd2d4c25f
sched/debug: Limit sd->*_idx range on sysctl

commit 201c373e8e4823700d3160d5c28e1ab18fd1193e upstream.

Various sd->*_idx's are used for refering the rq's load average table
when selecting a cpu to run.  However they can be set to any number
with sysctl knobs so that it can crash the kernel if something bad is
given. Fix it by limiting them into the actual range.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1345104204-8317-1-git-send-email-namhyung@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Rui Xiang <rui.xiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/sched/core.c