Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9c95e7319ba98585ebb6d304eca2d56f401ed70c
Commit:     9c95e7319ba98585ebb6d304eca2d56f401ed70c
Parent:     1799e35d5baab6e06168b46cc78b968e728ea3d1
Author:     Hiroshi Shimamoto <[EMAIL PROTECTED]>
AuthorDate: Wed Sep 19 23:34:46 2007 +0200
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Wed Sep 19 23:34:46 2007 +0200

    sched: fix invalid sched_class use
    
    When using rt_mutex, a NULL pointer dereference is occurred at
    enqueue_task_rt. Here is a scenario;
    1) there are two threads, the thread A is fair_sched_class and
       thread B is rt_sched_class.
    2) Thread A is boosted up to rt_sched_class, because the thread A
       has a rt_mutex lock and the thread B is waiting the lock.
    3) At this time, when thread A create a new thread C, the thread
       C has a rt_sched_class.
    4) When doing wake_up_new_task() for the thread C, the priority
       of the thread C is out of the RT priority range, because the
       normal priority of thread A is not the RT priority. It makes
       data corruption by overflowing the rt_prio_array.
    The new thread C should be fair_sched_class.
    
    The new thread should be valid scheduler class before queuing.
    This patch fixes to set the suitable scheduler class.
    
    Signed-off-by: Hiroshi Shimamoto <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Peter Zijlstra <[EMAIL PROTECTED]>
---
 kernel/sched.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 63e0971..6107a0c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1682,6 +1682,11 @@ void fastcall wake_up_new_task(struct task_struct *p, 
unsigned long clone_flags)
 
        p->prio = effective_prio(p);
 
+       if (rt_prio(p->prio))
+               p->sched_class = &rt_sched_class;
+       else
+               p->sched_class = &fair_sched_class;
+
        if (!p->sched_class->task_new || !sysctl_sched_child_runs_first ||
                        (clone_flags & CLONE_VM) || task_cpu(p) != this_cpu ||
                        !current->se.on_rq) {
-
To unsubscribe from this list: send the line "unsubscribe git-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