[asterisk-commits] mjordan: branch 11 r432198 - /branches/11/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 24 16:14:03 CST 2015


Author: mjordan
Date: Tue Feb 24 16:14:02 2015
New Revision: 432198

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=432198
Log:
channels/chan_sip: Fix crash when transmitting packet after thread shutdown

When the monitor thread is stopped, its pthread ID is set to a specific value
(AST_PTHREADT_STOP) so that later portions of the code can determine whether
or not it is safe to manipulate the thread. Unfortunately, __sip_reliable_xmit
failed to check for that value, checking instead only for AST_PTHREAD_STOP.
Passing the invalid yet very specific value to pthread_kill causes a crash.

This patch adds a check for AST_PTHREADT_STOP in __sip_reliable_xmit such that
it doesn't attempt to poke the thread if the thread has already been stopped.

ASTERISK-24800 #close
Reported by: JoshE

Modified:
    branches/11/channels/chan_sip.c

Modified: branches/11/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_sip.c?view=diff&rev=432198&r1=432197&r2=432198
==============================================================================
--- branches/11/channels/chan_sip.c (original)
+++ branches/11/channels/chan_sip.c Tue Feb 24 16:14:02 2015
@@ -29207,7 +29207,7 @@
 		ast_log(LOG_WARNING, "Cannot kill myself\n");
 		return -1;
 	}
-	if (monitor_thread != AST_PTHREADT_NULL) {
+	if (monitor_thread != AST_PTHREADT_NULL && monitor_thread != AST_PTHREADT_STOP) {
 		/* Wake up the thread */
 		pthread_kill(monitor_thread, SIGURG);
 	} else {




More information about the asterisk-commits mailing list