[svn-commits] russell: branch 1.6.0 r111910 - in /branches/1.6.0: ./ doc/ include/asterisk/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Mar 28 17:52:03 CDT 2008


Author: russell
Date: Fri Mar 28 17:52:02 2008
New Revision: 111910

URL: http://svn.digium.com/view/asterisk?view=rev&rev=111910
Log:
Merged revisions 111908-111909 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r111908 | russell | 2008-03-28 17:45:43 -0500 (Fri, 28 Mar 2008) | 3 lines

Note a minor race condition that I noticed while reviewing Jeff's changes
to this code.

........
r111909 | russell | 2008-03-28 17:50:46 -0500 (Fri, 28 Mar 2008) | 3 lines

Make some notes about common usage of pbx_builtin_getvar_helper() that is not
thread-safe.

........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/doc/janitor-projects.txt
    branches/1.6.0/include/asterisk/pbx.h
    branches/1.6.0/main/dnsmgr.c

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

Modified: branches/1.6.0/doc/janitor-projects.txt
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/doc/janitor-projects.txt?view=diff&rev=111910&r1=111909&r2=111910
==============================================================================
--- branches/1.6.0/doc/janitor-projects.txt (original)
+++ branches/1.6.0/doc/janitor-projects.txt Fri Mar 28 17:52:02 2008
@@ -1,3 +1,15 @@
+ -- There a bunch of places where the result of pbx_builtin_getvar_helper()
+    gets stored and used.  This is not threadsafe.  This code should be replaced
+	with the following thread-safe version:
+
+	const char *var;
+
+	ast_channel_lock(chan);
+	if ((var = pbx_builtin_getvar_helper(chan, "MYVAR"))) {
+		var = ast_strdupa(var);
+	}
+	ast_channel_unlock(chan);
+
  -- Convert all existing uses of astobj.h to astobj2.h
     -- (chan_sip already in progress in a branch)
 

Modified: branches/1.6.0/include/asterisk/pbx.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/pbx.h?view=diff&rev=111910&r1=111909&r2=111910
==============================================================================
--- branches/1.6.0/include/asterisk/pbx.h (original)
+++ branches/1.6.0/include/asterisk/pbx.h Fri Mar 28 17:52:02 2008
@@ -806,6 +806,20 @@
 
 /*!
  * \note Will lock the channel.
+ *
+ * \note This function will return a pointer to the buffer inside the channel
+ * variable.  This value should only be accessed with the channel locked.  If
+ * the value needs to be kept around, it should be done by using the following
+ * thread-safe code:
+ * \code
+ *		const char *var;
+ *
+ *		ast_channel_lock(chan);
+ *		if ((var = pbx_builtin_getvar_helper(chan, "MYVAR"))) {
+ *			var = ast_strdupa(var);
+ *		}
+ *		ast_channel_unlock(chan);
+ * \endcode
  */
 const char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name);
 

Modified: branches/1.6.0/main/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/dnsmgr.c?view=diff&rev=111910&r1=111909&r2=111910
==============================================================================
--- branches/1.6.0/main/dnsmgr.c (original)
+++ branches/1.6.0/main/dnsmgr.c Fri Mar 28 17:52:02 2008
@@ -21,6 +21,11 @@
  * \brief Background DNS update manager
  *
  * \author Kevin P. Fleming <kpfleming at digium.com> 
+ *
+ * \bug There is a minor race condition.  In the event that an IP address
+ * of a dnsmgr managed host changes, there is the potential for the consumer
+ * of that address to access the in_addr data at the same time that the dnsmgr
+ * thread is in the middle of updating it to the new address.
  */
 
 #include "asterisk.h"




More information about the svn-commits mailing list