diff options
author | Matthew Jordan <mjordan@digium.com> | 2015-02-24 22:14:44 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2015-02-24 22:14:44 +0000 |
commit | 8574c4d197ad6a763b6ee23e8d48d2af6d20ddfb (patch) | |
tree | a7f4e59561091e320b7127a134302d0aea225283 /channels | |
parent | a528dfc9a74341bf2dbe4e4bd66a1dd2d9c5f325 (diff) |
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
........
Merged revisions 432198 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 432199 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 43dc6afe6..f132cdda4 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -28915,7 +28915,7 @@ static int restart_monitor(void) 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 { |