aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-20 17:50:31 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-20 17:50:31 +0000
commite4f591091a1c38d9c4eb6e272d21e7c37e7221aa (patch)
treedc621bb25bd5c8b853489c6101a6d981ca5672eb
parentb98b4c4eb4b95ba440a8c1ee2619f37f5af58b5a (diff)
According to comments in main/pbx.c, it is essential that if we are going to lock
the conlock as well as the hints lock, it must be locked in that respective order. In order to prevent a potential deadlock, we need to lock the conlock prior to locking the hints lock in ast_hint_state_changed (see the call stack example on issue #11323 for how this can happen). (closes issue #11323, reported by eelcob, suggestion for patch by eelcob, patch by me) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@89457 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/pbx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/main/pbx.c b/main/pbx.c
index d50a0ddcf..4df500921 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -2002,6 +2002,7 @@ void ast_hint_state_changed(const char *device)
{
struct ast_hint *hint;
+ ast_mutex_lock(&conlock);
AST_LIST_LOCK(&hints);
AST_LIST_TRAVERSE(&hints, hint, list) {
@@ -2039,6 +2040,7 @@ void ast_hint_state_changed(const char *device)
}
AST_LIST_UNLOCK(&hints);
+ ast_mutex_unlock(&conlock);
}
/*! \brief ast_extension_state_add: Add watcher for extension states */