]> err.no Git - linux-2.6/commitdiff
[PATCH] fix sched_setscheduler semantics
authorJason Baron <jbaron@redhat.com>
Thu, 19 Jan 2006 01:43:03 +0000 (17:43 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 19 Jan 2006 03:20:22 +0000 (19:20 -0800)
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 <jbaron@redhat.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/sched.c

index 788ecce1e0e4d98701432bc6575cab35c3db3ad5..3ee2ae45125f711bd52eb8635cf335cc9b15ffe9 100644 (file)
@@ -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);
 }