[svn-commits] jpeeler: trunk r306216 - in /trunk: ./ channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Feb 3 17:50:15 CST 2011


Author: jpeeler
Date: Thu Feb  3 17:50:08 2011
New Revision: 306216

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=306216
Log:
Merged revisions 306215 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r306215 | jpeeler | 2011-02-03 17:49:28 -0600 (Thu, 03 Feb 2011) | 20 lines
  
  Fix SIP deadlock involving state changes.
  
  Once again a call to pbx_builtin_getvar_helper (and pbx_builtin_setvar_helper)
  has caused locking problems. Both of these functions lock the channel when
  the channel argument is passed in!
  
  In this case, the suspected problem (the backtrace makes it impossible to tell)
  was the private being locked in sip_set_rtp_peer and then:
  transmit_reinvite_with_sdp
   try_suggested_sip_codec
     pbx_builtin_getvar_helper
  (Traced to verify that the fix was only required in 1.8 and later.)
  
  (closes issue #18491)
  Reported by: cmaj
  Patches: 
        chan_sip_fix_deadlocks_bug_18491.txt uploaded by cmaj (license 830)
  Tested by: cmaj
........

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

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

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=306216&r1=306215&r2=306216
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Feb  3 17:50:08 2011
@@ -28052,10 +28052,12 @@
 		return 0;
 	}
 
+	ast_channel_lock(chan);
 	sip_pvt_lock(p);
 	if (p->alreadygone) {
 		/* If we're destroyed, don't bother */
 		sip_pvt_unlock(p);
+		ast_channel_unlock(chan);
 		return 0;
 	}
 
@@ -28064,6 +28066,7 @@
 	*/
 	if (nat_active && !ast_test_flag(&p->flags[0], SIP_DIRECT_MEDIA_NAT)) {
 		sip_pvt_unlock(p);
+		ast_channel_unlock(chan);
 		return 0;
 	}
 
@@ -28106,6 +28109,7 @@
 	/* Reset lastrtprx timer */
 	p->lastrtprx = p->lastrtptx = time(NULL);
 	sip_pvt_unlock(p);
+	ast_channel_unlock(chan);
 	return 0;
 }
 




More information about the svn-commits mailing list