diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-31 23:43:13 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-31 23:43:13 +0000 |
commit | 6420814534e02049c36455fc2f4a432aeca35a53 (patch) | |
tree | 2d22cf7653ded668af49b4d2a89b1ccaf7e6cb74 /main/pbx.c | |
parent | 4889cb40b38d515fbe1612b55159f69b99fe93e3 (diff) |
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)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@95577 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/pbx.c')
-rw-r--r-- | main/pbx.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/main/pbx.c b/main/pbx.c index 145c1be0b..915a6206f 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -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) |