[svn-commits] rmudgett: branch 10 r344271 - in /branches/10: ./ channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Nov 9 14:53:20 CST 2011


Author: rmudgett
Date: Wed Nov  9 14:53:16 2011
New Revision: 344271

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=344271
Log:
Fix deadlock during dialplan reload.

Another deadlock between the conlock/hints and channels/channel locking
orders.

* Don't hold the channel and private lock in sip_new() when calling
ast_exists_extension().

(closes issue ASTERISK-18740)
Reported by: Byron Clark
Patches:
      sip_exists_exten_dlock_3.diff (license #5041) patch uploaded by Gregory Hinton Nietsky
      ASTERISK-18740.patch (license #6157) patch uploaded by Byron Clark
Tested by: Byron Clark
........

Merged revisions 344268 from http://svn.asterisk.org/svn/asterisk/branches/1.8

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

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

Modified: branches/10/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/chan_sip.c?view=diff&rev=344271&r1=344270&r2=344271
==============================================================================
--- branches/10/channels/chan_sip.c (original)
+++ branches/10/channels/chan_sip.c Wed Nov  9 14:53:16 2011
@@ -6972,7 +6972,7 @@
 	int needvideo = 0;
 	int needtext = 0;
 	char buf[SIPBUFSIZE];
-	char *decoded_exten;
+	char *exten;
 
 	{
 		const char *my_name;	/* pick a good name */
@@ -7117,14 +7117,15 @@
 	 * we should decode the uri before storing it in the channel, but leave it encoded in the sip_pvt
 	 * structure so that there aren't issues when forming URI's
 	 */
-	if (ast_exists_extension(NULL, i->context, i->exten, 1, i->cid_num)) {
-		/* encoded in dialplan, so keep extension encoded */
-		ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
-	} else {
-		decoded_exten = ast_strdupa(i->exten);
-		ast_uri_decode(decoded_exten, ast_uri_sip_user);
-		ast_copy_string(tmp->exten, decoded_exten, sizeof(tmp->exten));
-	}
+	exten = ast_strdupa(i->exten);
+	sip_pvt_unlock(i);
+	ast_channel_unlock(tmp);
+	if (!ast_exists_extension(NULL, i->context, i->exten, 1, i->cid_num)) {
+		ast_uri_decode(exten, ast_uri_sip_user);
+	}
+	ast_channel_lock(tmp);
+	sip_pvt_lock(i);
+	ast_copy_string(tmp->exten, exten, sizeof(tmp->exten));
 
 	/* Don't use ast_set_callerid() here because it will
 	 * generate an unnecessary NewCallerID event  */




More information about the svn-commits mailing list