[asterisk-commits] mnicholson: trunk r219139 - in /trunk: ./ include/asterisk/cdr.h main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 17 10:18:06 CDT 2009


Author: mnicholson
Date: Thu Sep 17 10:18:01 2009
New Revision: 219139

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=219139
Log:
Merged revisions 219136 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r219136 | mnicholson | 2009-09-17 09:58:39 -0500 (Thu, 17 Sep 2009) | 10 lines
  
  Prevent a potential race condition and crash when hanging up a channel by removing the channel from the channel list before begining channel tear down.
  
  This fix may potentially cause problems with CDR backends that access the channel a CDR is associated with via the channel list.  This fix makes the channel unavabile at the time when the CDR backend is invoked.  This has been documented in include/asterisk/cdr.h.
  
  (closes issue #15316)
  Reported by: vmarrone
  Tested by: mnicholson
  
  Review: https://reviewboard.asterisk.org/r/362/
........

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/cdr.h
    trunk/main/channel.c

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

Modified: trunk/include/asterisk/cdr.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/include/asterisk/cdr.h?view=diff&rev=219139&r1=219138&r2=219139
==============================================================================
--- trunk/include/asterisk/cdr.h (original)
+++ trunk/include/asterisk/cdr.h Thu Sep 17 10:18:01 2009
@@ -124,6 +124,12 @@
 void ast_cdr_free_vars(struct ast_cdr *cdr, int recur);
 int ast_cdr_copy_vars(struct ast_cdr *to_cdr, struct ast_cdr *from_cdr);
 
+/*!
+ * \brief CDR backend callback
+ * \warning CDR backends should NOT attempt to access the channel associated
+ * with a CDR record.  This channel is not guaranteed to exist when the CDR
+ * backend is invoked.
+ */
 typedef int (*ast_cdrbe)(struct ast_cdr *cdr);
 
 /*! \brief Return TRUE if CDR subsystem is enabled */

Modified: trunk/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/channel.c?view=diff&rev=219139&r1=219138&r2=219139
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Thu Sep 17 10:18:01 2009
@@ -2119,6 +2119,11 @@
 		ast_channel_unlock(chan);
 		return 0;
 	}
+	ast_channel_unlock(chan);
+
+	ao2_unlink(channels, chan);
+
+	ast_channel_lock(chan);
 	free_translation(chan);
 	/* Close audio stream */
 	if (chan->stream) {




More information about the asterisk-commits mailing list