aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-16 20:41:31 +0000
committerrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-16 20:41:31 +0000
commit86a41ba61ae3bb895bb95695111d2dcbf90f5dfd (patch)
tree0dc7b150ac0bd439e1ce6904a184210d48259672 /main
parentcc5a982e471db6b9a89893d1b723b112db6818d6 (diff)
Merged revisions 319259 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r319259 | rmudgett | 2011-05-16 15:33:37 -0500 (Mon, 16 May 2011) | 13 lines Deadlock between generic CCSS agent and native ISDN CCSS. Deadlock can occur when the generic CCSS agent is deleting duplicate CC offers and the native ISDN CC driver is processing an incoming CC message. The cc_core_instances container lock cannot be held when an agent or monitor callback is invoked without the possibility of a deadlock. * Make kill_duplicate_offers() remove the reference in cc_core_instances outside of the container lock. JIRA AST-566 JIRA SWP-3469 ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@319260 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/ccss.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/main/ccss.c b/main/ccss.c
index e440b340e..71b27883a 100644
--- a/main/ccss.c
+++ b/main/ccss.c
@@ -2332,7 +2332,18 @@ static long count_agents(const char * const caller, const int core_id_exception)
static void kill_duplicate_offers(char *caller)
{
unsigned long match_flags = MATCH_NO_REQUEST;
- ao2_t_callback_data(cc_core_instances, OBJ_UNLINK | OBJ_NODATA, match_agent, caller, &match_flags, "Killing duplicate offers");
+ struct ao2_iterator *dups_iter;
+
+ /*
+ * Must remove the ref that was in cc_core_instances outside of
+ * the container lock to prevent deadlock.
+ */
+ dups_iter = ao2_t_callback_data(cc_core_instances, OBJ_MULTIPLE | OBJ_UNLINK,
+ match_agent, caller, &match_flags, "Killing duplicate offers");
+ if (dups_iter) {
+ /* Now actually unref any duplicate offers by simply destroying the iterator. */
+ ao2_iterator_destroy(dups_iter);
+ }
}
static void check_callback_sanity(const struct ast_cc_agent_callbacks *callbacks)