[asterisk-commits] russell: trunk r79222 - in /trunk: ./ channels/chan_iax2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 13 10:32:05 CDT 2007


Author: russell
Date: Mon Aug 13 10:32:05 2007
New Revision: 79222

URL: http://svn.digium.com/view/asterisk?view=rev&rev=79222
Log:
Merged revisions 79214 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79214 | russell | 2007-08-13 10:28:13 -0500 (Mon, 13 Aug 2007) | 4 lines

Fix a potential deadlock in socket_process.  check_provisioning can eventually
call find_callno.  You can't hold a pvt lock while calling find_callno because
it goes through and locks every single one looking for a match.

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_iax2.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=79222&r1=79221&r2=79222
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Mon Aug 13 10:32:05 2007
@@ -7447,8 +7447,15 @@
 				/* Ignore if it's already up */
 				if (ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED | IAX_STATE_TBD))
 					break;
-				if (ies.provverpres && ies.serviceident && sin.sin_addr.s_addr)
+				if (ies.provverpres && ies.serviceident && sin.sin_addr.s_addr) {
+					ast_mutex_unlock(&iaxsl[fr->callno]);
 					check_provisioning(&sin, fd, ies.serviceident, ies.provver);
+					ast_mutex_lock(&iaxsl[fr->callno]);
+					if (!iaxs[fr->callno]) {
+						ast_mutex_unlock(&iaxsl[fr->callno]);
+						return 1;
+					}
+				}
 				/* If we're in trunk mode, do it now, and update the trunk number in our frame before continuing */
 				if (ast_test_flag(iaxs[fr->callno], IAX_TRUNK)) {
 					int new_callno;
@@ -8109,8 +8116,15 @@
 						memset(&sin, 0, sizeof(sin));
 					if (update_registry(iaxs[fr->callno]->peer, &sin, fr->callno, ies.devicetype, fd, ies.refresh))
 						ast_log(LOG_WARNING, "Registry error\n");
-					if (ies.provverpres && ies.serviceident && sin.sin_addr.s_addr)
+					if (ies.provverpres && ies.serviceident && sin.sin_addr.s_addr) {
+						ast_mutex_unlock(&iaxsl[fr->callno]);
 						check_provisioning(&sin, fd, ies.serviceident, ies.provver);
+						ast_mutex_lock(&iaxsl[fr->callno]);
+						if (!iaxs[fr->callno]) {
+							ast_mutex_unlock(&iaxsl[fr->callno]);
+							return 1;
+						}
+					}
 					break;
 				}
 				registry_authrequest(iaxs[fr->callno]->peer, fr->callno);




More information about the asterisk-commits mailing list