diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 4107db0dc091..a646e4f36c41 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3486,7 +3486,7 @@ static void __setscheduler(struct task_struct *p, int policy, int prio) | |||
3486 | p->policy = policy; | 3486 | p->policy = policy; |
3487 | p->rt_priority = prio; | 3487 | p->rt_priority = prio; |
3488 | if (policy != SCHED_NORMAL) | 3488 | if (policy != SCHED_NORMAL) |
3489 | p->prio = MAX_USER_RT_PRIO-1 - p->rt_priority; | 3489 | p->prio = MAX_RT_PRIO-1 - p->rt_priority; |
3490 | else | 3490 | else |
3491 | p->prio = p->static_prio; | 3491 | p->prio = p->static_prio; |
3492 | } | 3492 | } |
@@ -3518,7 +3518,8 @@ recheck: | |||
3518 | * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL is 0. | 3518 | * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL is 0. |
3519 | */ | 3519 | */ |
3520 | if (param->sched_priority < 0 || | 3520 | if (param->sched_priority < 0 || |
3521 | param->sched_priority > MAX_USER_RT_PRIO-1) | 3521 | (p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) || |
3522 | (!p->mm && param->sched_priority > MAX_RT_PRIO-1)) | ||
3522 | return -EINVAL; | 3523 | return -EINVAL; |
3523 | if ((policy == SCHED_NORMAL) != (param->sched_priority == 0)) | 3524 | if ((policy == SCHED_NORMAL) != (param->sched_priority == 0)) |
3524 | return -EINVAL; | 3525 | return -EINVAL; |
@@ -3528,7 +3529,8 @@ recheck: | |||
3528 | */ | 3529 | */ |
3529 | if (!capable(CAP_SYS_NICE)) { | 3530 | if (!capable(CAP_SYS_NICE)) { |
3530 | /* can't change policy */ | 3531 | /* can't change policy */ |
3531 | if (policy != p->policy) | 3532 | if (policy != p->policy && |
3533 | !p->signal->rlim[RLIMIT_RTPRIO].rlim_cur) | ||
3532 | return -EPERM; | 3534 | return -EPERM; |
3533 | /* can't increase priority */ | 3535 | /* can't increase priority */ |
3534 | if (policy != SCHED_NORMAL && | 3536 | if (policy != SCHED_NORMAL && |