[asterisk-commits] dvossel: branch 1.6.1 r262238 - in /branches/1.6.1: ./ channels/chan_console.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 10 13:52:22 CDT 2010
Author: dvossel
Date: Mon May 10 13:52:19 2010
New Revision: 262238
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=262238
Log:
Merged revisions 262236 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r262236 | dvossel | 2010-05-10 13:36:10 -0500 (Mon, 10 May 2010) | 11 lines
fixes crash in chan_console
There is a race condition between console_hangup()
and start_stream(). It is possible for console_hangup()
to be called and then the stream thread to begin after the hangup.
To avoid this a check in start_stream() to make sure the pvt-owner
still exists while the pvt lock is held is made. If the owner
is gone that means the channel hung up and start_stream should
be aborted.
........
Modified:
branches/1.6.1/ (props changed)
branches/1.6.1/channels/chan_console.c
Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.1/channels/chan_console.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.1/channels/chan_console.c?view=diff&rev=262238&r1=262237&r2=262238
==============================================================================
--- branches/1.6.1/channels/chan_console.c (original)
+++ branches/1.6.1/channels/chan_console.c Mon May 10 13:52:19 2010
@@ -277,6 +277,10 @@
res = Pa_ReadStream(pvt->stream, buf, sizeof(buf) / sizeof(int16_t));
pthread_testcancel();
+ if (!pvt->owner) {
+ return NULL;
+ }
+
if (res == paNoError)
ast_queue_frame(pvt->owner, &f);
}
@@ -352,7 +356,10 @@
console_pvt_lock(pvt);
- if (pvt->streamstate)
+ /* It is possible for console_hangup to be called before the
+ * stream is started, if this is the case pvt->owner will be NULL
+ * and start_stream should be aborted. */
+ if (pvt->streamstate || !pvt->owner)
goto return_unlock;
pvt->streamstate = 1;
More information about the asterisk-commits
mailing list