aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-12-21 18:19:27 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2010-12-25 05:44:29 -0500
commitd06b68ec1e82842e02c37977fcebc0626d0becd5 (patch)
tree536e357fa0935fa425e413294265ec704ff8ab38
parentf07bb0a4549916107a7619d0bc4cb5dc09d5744a (diff)
bugfix: C-EDF, clear scheduled field of the correct CPU upon task_exitwip-timer-trace
Do not use the "scheduled_on" field to address the cpus structure within a cluster. cpus may contain less items than num_online_cpus and we may cause an out-of-bound access. Instead, use "scheduled_on" to directly access the per-cpu cpu_entry_t structure. Reported-by: Jonathan Herman <hermanjl@cs.unc.edu>
-rw-r--r--litmus/sched_cedf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index 8c9513d33f59..e815e31b1d84 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -587,7 +587,9 @@ static void cedf_task_exit(struct task_struct * t)
587 raw_spin_lock_irqsave(&cluster->lock, flags); 587 raw_spin_lock_irqsave(&cluster->lock, flags);
588 unlink(t); 588 unlink(t);
589 if (tsk_rt(t)->scheduled_on != NO_CPU) { 589 if (tsk_rt(t)->scheduled_on != NO_CPU) {
590 cluster->cpus[tsk_rt(t)->scheduled_on]->scheduled = NULL; 590 cpu_entry_t *cpu;
591 cpu = &per_cpu(cedf_cpu_entries, tsk_rt(t)->scheduled_on);
592 cpu->scheduled = NULL;
591 tsk_rt(t)->scheduled_on = NO_CPU; 593 tsk_rt(t)->scheduled_on = NO_CPU;
592 } 594 }
593 raw_spin_unlock_irqrestore(&cluster->lock, flags); 595 raw_spin_unlock_irqrestore(&cluster->lock, flags);