From c21761f168894b356626c847fe13be39605d76b4 Mon Sep 17 00:00:00 2001 From: Jason Baron Date: Wed, 18 Jan 2006 17:43:03 -0800 Subject: [PATCH] fix sched_setscheduler semantics Currently, a negative policy argument passed into the 'sys_sched_setscheduler()' system call, will return with success. However, the manpage for 'sys_sched_setscheduler' says: EINVAL The scheduling policy is not one of the recognized policies, or the parameter p does not make sense for the policy. Signed-off-by: Jason Baron Acked-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/sched.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/sched.c b/kernel/sched.c index 788ecce1e0e4..3ee2ae45125f 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -3850,6 +3850,10 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) asmlinkage long sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) { + /* negative values for policy are not valid */ + if (policy < 0) + return -EINVAL; + return do_sched_setscheduler(pid, policy, param); } -- cgit v1.2.3