[asterisk-commits] mattf: branch 1.6.0 r114777 - in /branches/1.6.0: ./ channels/chan_zap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 28 12:04:23 CDT 2008


Author: mattf
Date: Mon Apr 28 12:04:23 2008
New Revision: 114777

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

........
r114776 | mattf | 2008-04-28 12:00:38 -0500 (Mon, 28 Apr 2008) | 1 line

Fix deadlock issue in chan_zap with libss7 due to channel variables being set with the channel pvt lock being held. #12512
........

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

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

Modified: branches/1.6.0/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_zap.c?view=diff&rev=114777&r1=114776&r2=114777
==============================================================================
--- branches/1.6.0/channels/chan_zap.c (original)
+++ branches/1.6.0/channels/chan_zap.c Mon Apr 28 12:04:23 2008
@@ -9154,15 +9154,22 @@
 
 	ast_mutex_unlock(&linkset->lock);
 	c = zt_new(p, AST_STATE_RING, 1, SUB_REAL, law, 0);
-	ast_mutex_lock(&linkset->lock);
 
 	if (!c) {
 		ast_log(LOG_WARNING, "Unable to start PBX on CIC %d\n", p->cic);
+		/* Holding this lock is assumed entering the function */
+		ast_mutex_lock(&linkset->lock);
 		return;
 	} else
 		ast_verb(3, "Accepting call to '%s' on CIC %d\n", p->exten, p->cic);
 
 	zt_enable_ec(p);
+
+	/* We only reference these variables in the context of the ss7_linkset function
+	 * when receiving either and IAM or a COT message.  Since they are only accessed
+	 * from this context, we should be safe to unlock around them */
+
+	ast_mutex_unlock(&p->lock);
 
 	if (!ast_strlen_zero(p->charge_number)) {
 		pbx_builtin_setvar_helper(c, "SS7_CHARGE_NUMBER", p->charge_number);
@@ -9226,6 +9233,9 @@
 		/* Clear this after we set it */
 		p->generic_name[0] = 0;
 	}
+
+	ast_mutex_lock(&p->lock);
+	ast_mutex_lock(&linkset->lock);
 }
 
 static void ss7_apply_plan_to_number(char *buf, size_t size, const struct zt_ss7 *ss7, const char *number, const unsigned nai)




More information about the asterisk-commits mailing list