[asterisk-commits] rmudgett: branch 1.8 r319259 - /branches/1.8/main/ccss.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 16 15:33:42 CDT 2011


Author: rmudgett
Date: Mon May 16 15:33:37 2011
New Revision: 319259

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=319259
Log:
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

Modified:
    branches/1.8/main/ccss.c

Modified: branches/1.8/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/ccss.c?view=diff&rev=319259&r1=319258&r2=319259
==============================================================================
--- branches/1.8/main/ccss.c (original)
+++ branches/1.8/main/ccss.c Mon May 16 15:33:37 2011
@@ -2226,7 +2226,18 @@
 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)




More information about the asterisk-commits mailing list