diff options
author | Mark Michelson <mmichelson@digium.com> | 2008-01-16 17:21:49 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2008-01-16 17:21:49 +0000 |
commit | 343949b741f69489c2e08e987f75bf18618e3964 (patch) | |
tree | 435a81a50ae99871e7b6fe5354fe028e81115d02 /channels | |
parent | 3e9ed0d40b8275b3a2d126940ee0ac581f25f351 (diff) |
Merged revisions 98964 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r98964 | mmichelson | 2008-01-16 11:20:11 -0600 (Wed, 16 Jan 2008) | 10 lines
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: https://origsvn.digium.com/svn/asterisk/trunk@98965 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-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 3f4cfb5fb..e42368e32 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -501,8 +501,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); |