diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-16 17:20:11 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-16 17:20:11 +0000 |
commit | 5b8688e4f8fd2920f075a210a38965567fb1cc42 (patch) | |
tree | f874d656c528e2115492292776d5c76a80052372 /channels/chan_local.c | |
parent | 839e37689739de75e9065c321e234525b516c61c (diff) |
Fix a deadlock in chan_local in local_hangup. There was contention because
the local_pvt was held and it was attempting to lock a channel, which is the
incorrect locking order.
(closes issue #11730)
Reported by: UDI-Doug
Patches:
11730.patch uploaded by putnopvut (license 60)
Tested by: UDI-Doug
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@98964 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_local.c')
-rw-r--r-- | channels/chan_local.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c index 6985d8f75..200b12288 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -493,8 +493,16 @@ static int local_hangup(struct ast_channel *ast) isoutbound = IS_OUTBOUND(ast, p); if (isoutbound) { const char *status = pbx_builtin_getvar_helper(p->chan, "DIALSTATUS"); - if ((status) && (p->owner)) + if ((status) && (p->owner)) { + /* Deadlock avoidance */ + while (ast_channel_trylock(p->owner)) { + ast_mutex_unlock(&p->lock); + usleep(1); + ast_mutex_lock(&p->lock); + } pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status); + ast_channel_unlock(p->owner); + } p->chan = NULL; ast_clear_flag(p, LOCAL_LAUNCHED_PBX); ast_module_user_remove(p->u_chan); |