aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-01-10 10:39:19 -0500
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-01-10 10:43:17 -0500
commitb60b41eb47d4746d16c2c1365521bbcb94d6cd2e (patch)
treef56ec7ba1112eb33339072cd8bf1765e1b62337d
parentc158b5fbe42dacd34393082b6b8f9f6573ab8c5c (diff)
Avoid race in do_release_ts()
The list is concurrently being modified by the waking processes. This requires the use of the list_for_each_safe() iterator. Reported by Glenn Elliott.
-rw-r--r--litmus/sync.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/litmus/sync.c b/litmus/sync.c
index 873b3ffb2e7e..3e79e0a12a5a 100644
--- a/litmus/sync.c
+++ b/litmus/sync.c
@@ -89,7 +89,7 @@ static long do_release_ts(lt_t start)
89{ 89{
90 long task_count = 0; 90 long task_count = 0;
91 91
92 struct list_head *pos; 92 struct list_head *pos, *safe;
93 struct ts_release_wait *wait; 93 struct ts_release_wait *wait;
94 94
95 if (mutex_lock_interruptible(&task_release_lock)) { 95 if (mutex_lock_interruptible(&task_release_lock)) {
@@ -101,7 +101,7 @@ static long do_release_ts(lt_t start)
101 sched_trace_sys_release(&start); 101 sched_trace_sys_release(&start);
102 102
103 task_count = 0; 103 task_count = 0;
104 list_for_each(pos, &task_release_list) { 104 list_for_each_safe(pos, safe, &task_release_list) {
105 wait = (struct ts_release_wait*) 105 wait = (struct ts_release_wait*)
106 list_entry(pos, struct ts_release_wait, list); 106 list_entry(pos, struct ts_release_wait, list);
107 107