aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-12 19:57:42 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-12 19:57:42 +0000
commitb037f8762eb882bed64fed86bfa9c619bf5d8707 (patch)
tree7aa125946985e6644043521000dc248ab99b3187 /apps
parent52114d8ad0f8df2e09ab583451b376b75f11d738 (diff)
(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.4@108135 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 eb093e09f..f2951c3d5 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
*/