diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-12-21 18:19:27 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-01-03 06:45:28 -0500 |
commit | 73da50b48b6e7c60add2fcf0b683318b76ecb340 (patch) | |
tree | 536e357fa0935fa425e413294265ec704ff8ab38 /litmus/sched_cedf.c | |
parent | f07bb0a4549916107a7619d0bc4cb5dc09d5744a (diff) |
bugfix: clear scheduled field of the correct CPU upon task_exit in C-EDF
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>
Diffstat (limited to 'litmus/sched_cedf.c')
-rw-r--r-- | litmus/sched_cedf.c | 4 |
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); |