[asterisk-commits] dvossel: branch 1.6.0 r262239 - in /branches/1.6.0: ./ channels/chan_console.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 10 13:57:47 CDT 2010
Author: dvossel
Date: Mon May 10 13:57:44 2010
New Revision: 262239
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=262239
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.0/ (props changed)
branches/1.6.0/channels/chan_console.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/channels/chan_console.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/channels/chan_console.c?view=diff&rev=262239&r1=262238&r2=262239
==============================================================================
--- branches/1.6.0/channels/chan_console.c (original)
+++ branches/1.6.0/channels/chan_console.c Mon May 10 13:57:44 2010
@@ -275,6 +275,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);
}
@@ -350,7 +354,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