tree 0afe4590170ad25e38005f72431680ba47ba6860
parent 18586e721636527cb5177467fb17e2350615978a
author Steven Rostedt <[EMAIL PROTECTED]> Tue, 26 Jul 2005 00:28:39 -0400
committer Linus Torvalds <[EMAIL PROTECTED]> Wed, 27 Jul 2005 05:40:00 -0700

[PATCH] fix MAX_USER_RT_PRIO and MAX_RT_PRIO

Here's the patch again to fix the code to handle if the values between
MAX_USER_RT_PRIO and MAX_RT_PRIO are different.

Without this patch, an SMP system will crash if the values are
different.

Signed-off-by: Steven Rostedt <[EMAIL PROTECTED]>
Cc: Ingo Molnar <[EMAIL PROTECTED]>
Signed-off-by: Dean Nelson <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 arch/ia64/sn/kernel/xpc_main.c |    2 +-
 kernel/sched.c                 |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -420,7 +420,7 @@ xpc_activating(void *__partid)
        partid_t partid = (u64) __partid;
        struct xpc_partition *part = &xpc_partitions[partid];
        unsigned long irq_flags;
-       struct sched_param param = { sched_priority: MAX_USER_RT_PRIO - 1 };
+       struct sched_param param = { sched_priority: MAX_RT_PRIO - 1 };
        int ret;
 
 
diff --git a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3486,7 +3486,7 @@ static void __setscheduler(struct task_s
        p->policy = policy;
        p->rt_priority = prio;
        if (policy != SCHED_NORMAL)
-               p->prio = MAX_USER_RT_PRIO-1 - p->rt_priority;
+               p->prio = MAX_RT_PRIO-1 - p->rt_priority;
        else
                p->prio = p->static_prio;
 }
@@ -3518,7 +3518,8 @@ recheck:
         * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL is 0.
         */
        if (param->sched_priority < 0 ||
-           param->sched_priority > MAX_USER_RT_PRIO-1)
+           (p->mm &&  param->sched_priority > MAX_USER_RT_PRIO-1) ||
+           (!p->mm && param->sched_priority > MAX_RT_PRIO-1))
                return -EINVAL;
        if ((policy == SCHED_NORMAL) != (param->sched_priority == 0))
                return -EINVAL;
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to