]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Resolve a potential deadlock. In this case, a single queue is locked, then the queue...
authorMark Michelson <mmichelson@digium.com>
Mon, 27 Aug 2007 22:40:19 +0000 (22:40 +0000)
committerMark Michelson <mmichelson@digium.com>
Mon, 27 Aug 2007 22:40:19 +0000 (22:40 +0000)
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: https://origsvn.digium.com/svn/asterisk/branches/1.4@81158 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c

index 298fab19e4e77c6c564864e369c764d927f98aee..56ab9fc73082f1c830e50712a99ef24549685799 100644 (file)
@@ -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 {