[asterisk-commits] russell: branch 1.4 r67119 - /branches/1.4/channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jun 4 15:28:56 MST 2007


Author: russell
Date: Mon Jun  4 17:28:55 2007
New Revision: 67119

URL: http://svn.digium.com/view/asterisk?view=rev&rev=67119
Log:
Add comments for two functions that get called with the appropriate call locked,
but perform operations that could result in the pvt structure getting destroyed
before returning again, causing numerous seg faults all over the module.
(inspired by issues #9642, #9569, and #9666, and the work done by stevedavies
 and mihai)

Modified:
    branches/1.4/channels/chan_iax2.c

Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=67119&r1=67118&r2=67119
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Mon Jun  4 17:28:55 2007
@@ -1294,6 +1294,16 @@
 	iax_frame_free(fr);
 }
 
+/*!
+ * \brief Queue a frame to a call's owning asterisk channel
+ *
+ * \note This function assumes that iaxsl[callno] is locked when called.
+ *
+ * \note IMPORTANT NOTE!!! Any time this function is used, even if iaxs[callno]
+ * was valid before calling it, it may no longer be valid after calling it.
+ * This function may unlock and lock the mutex associated with this callno,
+ * meaning that another thread may grab it and destroy the call.
+ */
 static int iax2_queue_frame(int callno, struct ast_frame *f)
 {
 	/* Assumes lock for callno is already held... */
@@ -1577,6 +1587,14 @@
 	ast_mutex_unlock(&waresl.lock);
 }
 
+/*!
+ * \note This function assumes that iaxsl[callno] is locked when called.
+ *
+ * \note IMPORTANT NOTE!!! Any time this function is used, even if iaxs[callno]
+ * was valid before calling it, it may no longer be valid after calling it.
+ * This function calls iax2_queue_frame(), which may unlock and lock the mutex 
+ * associated with this callno, meaning that another thread may grab it and destroy the call.
+ */
 static int __do_deliver(void *data)
 {
 	/* Just deliver the packet by using queueing.  This is called by



More information about the asterisk-commits mailing list