[asterisk-commits] rmudgett: branch 10 r337008 - in /branches/10: ./ channels/sig_ss7.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 20 14:12:26 CDT 2011


Author: rmudgett
Date: Tue Sep 20 14:12:24 2011
New Revision: 337008

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

........
  r337007 | rmudgett | 2011-09-20 14:10:30 -0500 (Tue, 20 Sep 2011) | 15 lines
  
  Check if a channel was created before using the pointer in sig_ss7_new_ast_channel().
  
  Fixes the crash in ASTERISK-17955 gdb-11918.txt backtrace.
  
  * Added some missing libss7 access lock protection.
  
  * Prevent cancelling the ss7_linkset() thread at inoportune times just
  like the pri_dchannel() thread.
  
  (issue ASTERISK-17955)
  Reported by: Ian M Sherman
  Patches:
        jira_asterisk_17955_v1.8.patch (license #5621) patch uploaded by rmudgett
        (attached to related ASTERISK-17966)
........

Modified:
    branches/10/   (props changed)
    branches/10/channels/sig_ss7.c

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

Modified: branches/10/channels/sig_ss7.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/sig_ss7.c?view=diff&rev=337008&r1=337007&r2=337008
==============================================================================
--- branches/10/channels/sig_ss7.c (original)
+++ branches/10/channels/sig_ss7.c Tue Sep 20 14:12:24 2011
@@ -215,6 +215,9 @@
 	if (p->calls->new_ast_channel) {
 		ast = p->calls->new_ast_channel(p->chan_pvt, state, ulaw, exten, requestor);
 	} else {
+		return NULL;
+	}
+	if (!ast) {
 		return NULL;
 	}
 
@@ -618,8 +621,12 @@
 	unsigned int dpc;
 	int nextms = 0;
 
+	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
+
 	ss7_set_debug(ss7, SIG_SS7_DEBUG_DEFAULT);
+	ast_mutex_lock(&linkset->lock);
 	ss7_start(ss7);
+	ast_mutex_unlock(&linkset->lock);
 
 	for (;;) {
 		ast_mutex_lock(&linkset->lock);
@@ -638,15 +645,20 @@
 			nextms = tv.tv_sec * 1000;
 			nextms += tv.tv_usec / 1000;
 		}
-		ast_mutex_unlock(&linkset->lock);
 
 		for (i = 0; i < linkset->numsigchans; i++) {
 			pollers[i].fd = linkset->fds[i];
 			pollers[i].events = ss7_pollflags(ss7, linkset->fds[i]);
 			pollers[i].revents = 0;
 		}
-
+		ast_mutex_unlock(&linkset->lock);
+
+		pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+		pthread_testcancel();
 		res = poll(pollers, linkset->numsigchans, nextms);
+		pthread_testcancel();
+		pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
+
 		if ((res < 0) && (errno != EINTR)) {
 			ast_log(LOG_ERROR, "poll(%s)\n", strerror(errno));
 		} else if (!res) {
@@ -1547,8 +1559,11 @@
 		ast_debug(1,"Received AST_CONTROL_PROCEEDING on %s\n",chan->name);
 		/* This IF sends the FAR for an answered ALEG call */
 		if (chan->_state == AST_STATE_UP && (p->rlt != 1)){
-			if ((isup_far(p->ss7->ss7, p->ss7call)) != -1)
+			ss7_grab(p, p->ss7);
+			if ((isup_far(p->ss7->ss7, p->ss7call)) != -1) {
 				p->rlt = 1;
+			}
+			ss7_rel(p->ss7);
 		}
 
 		if (p->call_level < SIG_SS7_CALL_LEVEL_PROCEEDING && !p->outgoing) {




More information about the asterisk-commits mailing list