summaryrefslogtreecommitdiff
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-06-06 21:34:10 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-06-06 21:34:10 +0000
commit0f71b29e2fb6210573652da80f7f9da1e6509665 (patch)
treecce78139cd3c5cdad22ed445f9d6f4bd16b0dee4 /channels/chan_dahdi.c
parentea8cf8b5f3d186ea7f8e120f2f812a565775ed7e (diff)
Fix POTS flash hook to orignate a second call deadlock.
A deadlock can occur when a POTS phone tries to flash hook to originate a second call for 3-way or transfer. If another process is scanning the channels container when the POTS line flash hooks then a deadlock will occur. * Release the channel and private locks when creating a new channel as a result of a flash hook. (closes issue ASTERISK-19842) Reported by: rmudgett Tested by: rmudgett ........ Merged revisions 368644 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 368645 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368646 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 0db84df1f..46c45899b 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -8603,8 +8603,18 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
ast_log(LOG_WARNING, "Unable to allocate three-way subchannel\n");
goto winkflashdone;
}
- /* Make new channel */
+
+ /*
+ * Make new channel
+ *
+ * We cannot hold the p or ast locks while creating a new
+ * channel.
+ */
+ ast_mutex_unlock(&p->lock);
+ ast_channel_unlock(ast);
chan = dahdi_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, NULL);
+ ast_channel_lock(ast);
+ ast_mutex_lock(&p->lock);
if (p->dahditrcallerid) {
if (!p->origcid_num)
p->origcid_num = ast_strdup(p->cid_num);