aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-19 16:45:37 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-19 16:45:37 +0000
commit3b437bc65697cf5cb041d616f2ec04559d240ac6 (patch)
treed475d56c087f7b9544b4b25ea235370a04b5b11a /channels
parent6c66819b23239562fff61bcdff7488da4d9c7c82 (diff)
Backport fix for crashes related to subscriptions from 1.4 ...
Fix a crash that could occur when handing device state changes. When the state of a device changes, the device state thread tells the extension state handling code that it changed. Then, the extension state code calls the callback in chan_sip so that it can update subscriptions to that extension. A pointer to a sip_pvt structure is passed to this function as the call which needs a NOTIFY sent. However, there was no locking done to ensure that the pvt struct didn't disappear during this process. (issue #9946, reported by tdonahue, patch by me, patch updated to trunk to use the sip_pvt lock wrappers by eliel) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@69990 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 868fe8c82..afc412aa8 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -6557,6 +6557,8 @@ static int cb_extensionstate(char *context, char* exten, int state, void *data)
{
struct sip_pvt *p = data;
+ ast_mutex_lock(&p->lock);
+
switch(state) {
case AST_EXTENSION_DEACTIVATED: /* Retry after a while */
case AST_EXTENSION_REMOVED: /* Extension is gone */
@@ -6576,6 +6578,9 @@ static int cb_extensionstate(char *context, char* exten, int state, void *data)
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username);
+
+ ast_mutex_unlock(&p->lock);
+
return 0;
}