[asterisk-commits] rmudgett: branch 10 r368645 - in /branches/10: ./ channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 6 16:32:12 CDT 2012


Author: rmudgett
Date: Wed Jun  6 16:32:09 2012
New Revision: 368645

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=368645
Log:
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

Modified:
    branches/10/   (props changed)
    branches/10/channels/chan_dahdi.c
    branches/10/channels/sig_analog.c

Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/10/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/chan_dahdi.c?view=diff&rev=368645&r1=368644&r2=368645
==============================================================================
--- branches/10/channels/chan_dahdi.c (original)
+++ branches/10/channels/chan_dahdi.c Wed Jun  6 16:32:09 2012
@@ -8601,8 +8601,18 @@
 						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);

Modified: branches/10/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/sig_analog.c?view=diff&rev=368645&r1=368644&r2=368645
==============================================================================
--- branches/10/channels/sig_analog.c (original)
+++ branches/10/channels/sig_analog.c Wed Jun  6 16:32:09 2012
@@ -3205,8 +3205,18 @@
 						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.
+					 */
+					analog_unlock_private(p);
+					ast_channel_unlock(ast);
 					chan = analog_new_ast_channel(p, AST_STATE_RESERVED, 0, ANALOG_SUB_THREEWAY, NULL);
+					ast_channel_lock(ast);
+					analog_lock_private(p);
 					if (!chan) {
 						ast_log(LOG_WARNING,
 							"Cannot allocate new call structure on channel %d\n",




More information about the asterisk-commits mailing list