aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-02-12 23:35:06 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-02-12 23:35:06 +0000
commitc8ac877772573e0f39779f89878d74ba30414e7c (patch)
tree8d94f66a7c776f5bf0a35e09ca78d5e0f46edf49
parent9b143932979693e38ae1f222b1759e5b22cc25a4 (diff)
Merged revisions 246546 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r246546 | dvossel | 2010-02-12 17:32:33 -0600 (Fri, 12 Feb 2010) | 21 lines Merged revisions 246545 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r246545 | dvossel | 2010-02-12 17:30:17 -0600 (Fri, 12 Feb 2010) | 16 lines lock channel during datastore removal On channel destruction the channel's datastores are removed and destroyed. Since there are public API calls to find and remove datastores on a channel, a lock should be held whenever datastores are removed and destroyed. This resolves a crash caused by a race condition in app_chanspy.c. (closes issue #16678) Reported by: tim_ringenbach Patches: datastore_destroy_race.diff uploaded by tim ringenbach (license 540) Tested by: dvossel ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@246549 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/channel.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index cae71d5e9..cb0c9f287 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1372,9 +1372,11 @@ void ast_channel_free(struct ast_channel *chan)
}
/* Get rid of each of the data stores on the channel */
+ ast_channel_lock(chan);
while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry)))
/* Free the data store */
ast_channel_datastore_free(datastore);
+ ast_channel_unlock(chan);
/* Lock and unlock the channel just to be sure nobody has it locked still
due to a reference that was stored in a datastore. (i.e. app_chanspy) */