aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-27 22:40:19 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-27 22:40:19 +0000
commit2739cc7c750b6305eb6d05e94fb48e0d5b7b0ea9 (patch)
tree329ff8af9b26e54089f9dab07d82c00f1e66e574 /apps
parent10ac8e4ff707e274aba71b22a0c3bd85a597df1c (diff)
Resolve a potential deadlock. In this case, a single queue is locked, then the queue list. In changethread(), the queue list is
locked, and then each individual queue is locked. Under the right circumstances, this could deadlock. As such, I have unlocked the individual queue before locking the queue list, and then locked the queue back after the queue list is unlocked. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@81158 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 298fab19e..56ab9fc73 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1106,7 +1106,9 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
} else {
q->members = next_m;
}
+ ast_mutex_unlock(&q->lock);
remove_from_interfaces(m->interface);
+ ast_mutex_lock(&q->lock);
q->membercount--;
free(m);
} else {
@@ -1160,7 +1162,9 @@ static void update_realtime_members(struct call_queue *q)
} else {
q->members = next_m;
}
+ ast_mutex_unlock(&q->lock);
remove_from_interfaces(m->interface);
+ ast_mutex_lock(&q->lock);
q->membercount--;
free(m);
} else {