]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Avoiding a potentially bad locking situation. ast_merge_contexts_and_delete writelock...
authorMark Michelson <mmichelson@digium.com>
Mon, 31 Dec 2007 23:43:13 +0000 (23:43 +0000)
committerMark Michelson <mmichelson@digium.com>
Mon, 31 Dec 2007 23:43:13 +0000 (23:43 +0000)
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)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@95577 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/pbx.c

index 145c1be0b4b9e705b57ca1a3544d2b71b8ac8032..915a6206fe71fc7942f798961c193cccd1423888 100644 (file)
@@ -3994,7 +3994,8 @@ void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char
           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)