aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-12 19:59:24 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-12 19:59:24 +0000
commitf785dcee4af7faab0ed36349ebce01acff1a44e4 (patch)
tree22edc86d71e028078cb1c40307a069ba87560cc2 /apps
parenta44b9dcf2cf65bb7baaff18b51d2305a8fea1529 (diff)
Merged revisions 108137 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r108137 | russell | 2008-03-12 14:59:05 -0500 (Wed, 12 Mar 2008) | 48 lines Merged revisions 108135 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r108135 | russell | 2008-03-12 14:57:42 -0500 (Wed, 12 Mar 2008) | 40 lines (closes issue #12187, reported by atis, fixed by me after some brainstorming on the issue with mmichelson) - Update copyright info on app_chanspy. - Fix a race condition that caused app_chanspy to crash. The issue was that the chanspy datastore magic that was used to ensure that spyee channels did not disappear out from under the code did not completely solve the problem. It was actually possible for chanspy to acquire a channel reference out of its datastore to a channel that was in the middle of being destroyed. That was because datastore destruction in ast_channel_free() was done near the end. So, this left the code in app_chanspy accessing a channel that was partially, or completely invalid because it was in the process of being free'd by another thread. The following sort of shows the code path where the race occurred: ============================================================================= Thread 1 (PBX thread for spyee chan) || Thread 2 (chanspy) --------------------------------------||------------------------------------- ast_channel_free() || - remove channel from channel list || - lock/unlock the channel to ensure || that no references retrieved from || the channel list exist. || --------------------------------------||------------------------------------- || channel_spy() - destroy some channel data || - Lock chanspy datastore || - Retrieve reference to channel || - lock channel || - Unlock chanspy datastore --------------------------------------||------------------------------------- - destroy channel datastores || - call chanspy datastore d'tor || which NULL's out the ds' || - Operate on the channel ... reference to the channel || || - free the channel || || || - unlock the channel --------------------------------------||------------------------------------- ============================================================================= ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@108138 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_chanspy.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index 0bf676891..d7047d047 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -2,7 +2,7 @@
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2005 Anthony Minessale II (anthmct@yahoo.com)
- * Copyright (C) 2005 - 2006, Digium, Inc.
+ * Copyright (C) 2005 - 2008, Digium, Inc.
*
* A license has been granted to Digium (via disclaimer) for the use of
* this code.
@@ -23,6 +23,8 @@
* \brief ChanSpy: Listen in on any channel.
*
* \author Anthony Minessale II <anthmct@yahoo.com>
+ * \author Joshua Colp <jcolp@digium.com>
+ * \author Russell Bryant <russell@digium.com>
*
* \ingroup applications
*/