[asterisk-commits] tilghman: branch 1.6.0 r120034 - in /branches/1.6.0: ./ channels/chan_iax2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 3 11:24:09 CDT 2008


Author: tilghman
Date: Tue Jun  3 11:24:08 2008
New Revision: 120034

URL: http://svn.digium.com/view/asterisk?view=rev&rev=120034
Log:
Merged revisions 120012 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r120012 | tilghman | 2008-06-03 11:19:35 -0500 (Tue, 03 Jun 2008) | 17 lines

Merged revisions 120001 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r120001 | tilghman | 2008-06-03 11:10:53 -0500 (Tue, 03 Jun 2008) | 9 lines

Save the callno when we're poking, because our peer structure could change
during deadlock avoidance (and thus we unlock the wrong callno, causing a
cascade failure).
(closes issue #12717)
 Reported by: gewfie
 Patches: 
       20080525__bug12717.diff.txt uploaded by Corydon76 (license 14)
 Tested by: gewfie

........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/channels/chan_iax2.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_iax2.c?view=diff&rev=120034&r1=120033&r2=120034
==============================================================================
--- branches/1.6.0/channels/chan_iax2.c (original)
+++ branches/1.6.0/channels/chan_iax2.c Tue Jun  3 11:24:08 2008
@@ -9740,6 +9740,7 @@
 
 static int iax2_poke_peer(struct iax2_peer *peer, int heldcall)
 {
+	int callno;
 	if (!peer->maxms || (!peer->addr.sin_addr.s_addr && !peer->dnsmgr)) {
 		/* IF we have no IP without dnsmgr, or this isn't to be monitored, return
 		  immediately after clearing things out */
@@ -9749,11 +9750,13 @@
 		peer->callno = 0;
 		return 0;
 	}
-	if (peer->callno > 0) {
+
+	/* The peer could change the callno inside iax2_destroy, since we do deadlock avoidance */
+	if ((callno = peer->callno) > 0) {
 		ast_log(LOG_NOTICE, "Still have a callno...\n");
-		ast_mutex_lock(&iaxsl[peer->callno]);
-		iax2_destroy(peer->callno);
-		ast_mutex_unlock(&iaxsl[peer->callno]);
+		ast_mutex_lock(&iaxsl[callno]);
+		iax2_destroy(callno);
+		ast_mutex_unlock(&iaxsl[callno]);
 	}
 	if (heldcall)
 		ast_mutex_unlock(&iaxsl[heldcall]);




More information about the asterisk-commits mailing list