[svn-commits] russell: trunk r291395 - in /trunk: ./ channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Oct 13 10:51:42 CDT 2010


Author: russell
Date: Wed Oct 13 10:51:39 2010
New Revision: 291395

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

................
  r291394 | russell | 2010-10-13 10:46:39 -0500 (Wed, 13 Oct 2010) | 20 lines
  
  Merged revisions 291393 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r291393 | russell | 2010-10-13 10:29:21 -0500 (Wed, 13 Oct 2010) | 13 lines
    
    Merged revisions 291392 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r291392 | russell | 2010-10-13 10:23:19 -0500 (Wed, 13 Oct 2010) | 6 lines
      
      Lock pvt so pvt->owner can't disappear when queueing up a frame.
      
      This fixes a crash due to a hangup race condition.
      
      ABE-2601
    ........
  ................
................

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=291395&r1=291394&r2=291395
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Oct 13 10:51:39 2010
@@ -3637,9 +3637,21 @@
 	/* Reset schedule ID */
 	p->autokillid = -1;
 
+
+	/*
+	 * Lock both the pvt and the channel safely so that we can queue up a frame.
+	 */
+	sip_pvt_lock(p);
+	while (p->owner && ast_channel_trylock(p->owner)) {
+		sip_pvt_unlock(p);
+		sched_yield();
+		sip_pvt_lock(p);
+	}
+
 	if (p->owner) {
 		ast_log(LOG_WARNING, "Autodestruct on dialog '%s' with owner in place (Method: %s)\n", p->callid, sip_methods[p->method].text);
 		ast_queue_hangup_with_cause(p->owner, AST_CAUSE_PROTOCOL_ERROR);
+		ast_channel_unlock(p->owner);
 	} else if (p->refer && !p->alreadygone) {
 		ast_debug(3, "Finally hanging up channel after transfer: %s\n", p->callid);
 		transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
@@ -3653,7 +3665,11 @@
 		/* sip_destroy(p); */		/* Go ahead and destroy dialog. All attempts to recover is done */
 		/* sip_destroy also absorbs the reference */
 	}
+
+	sip_pvt_unlock(p);
+
 	dialog_unref(p, "The ref to a dialog passed to this sched callback is going out of scope; unref it.");
+
 	return 0;
 }
 




More information about the svn-commits mailing list