[asterisk-commits] russell: branch 1.4 r79214 - /branches/1.4/channels/chan_iax2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Aug 13 10:28:14 CDT 2007
Author: russell
Date: Mon Aug 13 10:28:13 2007
New Revision: 79214
URL: http://svn.digium.com/view/asterisk?view=rev&rev=79214
Log:
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:
branches/1.4/channels/chan_iax2.c
Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=79214&r1=79213&r2=79214
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Mon Aug 13 10:28:13 2007
@@ -6981,8 +6981,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;
@@ -7583,8 +7590,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