diff --git a/kernel/sched.c b/kernel/sched.c index 788ecce1e0e..3ee2ae45125 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); }