summaryrefslogtreecommitdiff
path: root/kernel/sched/core.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2014-05-09 10:49:03 +0200
committerIngo Molnar <mingo@kernel.org>2014-05-22 10:21:26 +0200
commitdbdb22754fde671dc93d2fae06f8be113d47f2fb (patch)
tree150c824b8fb435ca64f034c740804e7a7da2297b /kernel/sched/core.c
parent143cf23df25b7082cd706c3c53188e741e7881c3 (diff)
sched: Disallow sched_attr::sched_policy < 0
The scheduler uses policy=-1 to preserve the current policy state to implement sys_sched_setparam(), this got exposed to userspace by accident through sys_sched_setattr(), cure this. Reported-by: Michael Kerrisk <mtk.manpages@gmail.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Acked-by: Michael Kerrisk <mtk.manpages@gmail.com> Cc: <stable@vger.kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/20140509085311.GJ30445@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r--kernel/sched/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f2205f02eb70..cdefcf7c5925 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3662,6 +3662,9 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
if (retval)
return retval;
+ if (attr.sched_policy < 0)
+ return -EINVAL;
+
rcu_read_lock();
retval = -ESRCH;
p = find_process_by_pid(pid);