[asterisk-commits] rmudgett: trunk r375364 - in /trunk: ./ channels/chan_dahdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 29 10:56:17 CDT 2012


Author: rmudgett
Date: Mon Oct 29 10:56:13 2012
New Revision: 375364

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=375364
Log:
chan_dahdi: Fix segfault dereferencing a NULL tech_pvt.

The tech support customer was using the AMI Redirect action shortly after
a call was placed.  While the channel tried to do an ast_read(), the
masquerade resulting from the channel redirect took place.  The masquerade
in the middle of the ast_read() resulted in the segfault.

(closes issue AST-1025)
Reported by: Trey Blancher
Patches:
      jira_ast_1025_v1.8_v2.patch (license #5621) patch uploaded by rmudgett
........

Merged revisions 375361 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375362 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 375363 from http://svn.asterisk.org/svn/asterisk/branches/11

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

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

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=375364&r1=375363&r2=375364
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Mon Oct 29 10:56:13 2012
@@ -9130,11 +9130,20 @@
 		CHANNEL_DEADLOCK_AVOIDANCE(ast);
 
 		/*
-		 * For PRI channels, we must refresh the private pointer because
-		 * the call could move to another B channel while the Asterisk
-		 * channel is unlocked.
+		 * Check to see if the channel is still associated with the same
+		 * private structure.  While the Asterisk channel was unlocked
+		 * the following events may have occured:
+		 *
+		 * 1) A masquerade may have associated the channel with another
+		 * technology or private structure.
+		 *
+		 * 2) For PRI calls, call signaling could change the channel
+		 * association to another B channel (private structure).
 		 */
-		p = ast_channel_tech_pvt(ast);
+		if (ast_channel_tech_pvt(ast) != p) {
+			/* The channel is no longer associated.  Quit gracefully. */
+			return &ast_null_frame;
+		}
 	}
 
 	idx = dahdi_get_index(ast, p, 0);




More information about the asterisk-commits mailing list