[asterisk-commits] mmichelson: branch 1.4 r95577 - /branches/1.4/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 31 17:43:13 CST 2007


Author: mmichelson
Date: Mon Dec 31 17:43:13 2007
New Revision: 95577

URL: http://svn.digium.com/view/asterisk?view=rev&rev=95577
Log:
Avoiding a potentially bad locking situation. ast_merge_contexts_and_delete writelocks the conlock, then
calls ast_hint_extension, which attempts to readlock the same lock. Recursion with read-write locks is 
dangerous, so the inner lock needs to be removed. I did this by copying the "guts" of ast_hint_extension
into ast_merge_contexts_and_delete (sans the extra lock).

(this change is inspired by the locking problems seen in issue #11080, but I have no idea if this is the
problematic area experienced by the reporters of that issue)


Modified:
    branches/1.4/main/pbx.c

Modified: branches/1.4/main/pbx.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/pbx.c?view=diff&rev=95577&r1=95576&r2=95577
==============================================================================
--- branches/1.4/main/pbx.c (original)
+++ branches/1.4/main/pbx.c Mon Dec 31 17:43:13 2007
@@ -3994,7 +3994,8 @@
 	   cannot be restored
 	*/
 	while ((this = AST_LIST_REMOVE_HEAD(&store, list))) {
-		exten = ast_hint_extension(NULL, this->context, this->exten);
+		struct pbx_find_info q = { .stacklen = 0 };
+		exten = pbx_find_extension(NULL, NULL, &q, this->context, this->exten, PRIORITY_HINT, NULL, "", E_MATCH);
 		/* Find the hint in the list of hints */
 		AST_LIST_TRAVERSE(&hints, hint, list) {
 			if (hint->exten == exten)




More information about the asterisk-commits mailing list