[asterisk-commits] rmudgett: branch 12 r426531 - /branches/12/bridges/bridge_builtin_features.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 28 16:16:23 CDT 2014


Author: rmudgett
Date: Tue Oct 28 16:16:21 2014
New Revision: 426531

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=426531
Log:
bridge_builtin_features: Add missing channel locks around ast_get_chan_features_general_config().

The feature_automonitor() and feature_automixmonitor() functions were not
locking the channel around ast_get_chan_features_general_config().
Accessing the channel datastore list without the channel locked is a good
way to corrupt the list or follow the pointer chain into oblivion.

Modified:
    branches/12/bridges/bridge_builtin_features.c

Modified: branches/12/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/bridges/bridge_builtin_features.c?view=diff&rev=426531&r1=426530&r2=426531
==============================================================================
--- branches/12/bridges/bridge_builtin_features.c (original)
+++ branches/12/bridges/bridge_builtin_features.c Tue Oct 28 16:16:21 2014
@@ -226,7 +226,9 @@
 	RAII_VAR(struct ast_channel *, peer_chan, NULL, ast_channel_cleanup);
 	RAII_VAR(struct ast_features_general_config *, features_cfg, NULL, ao2_cleanup);
 
+	ast_channel_lock(bridge_channel->chan);
 	features_cfg = ast_get_chan_features_general_config(bridge_channel->chan);
+	ast_channel_unlock(bridge_channel->chan);
 	ast_bridge_channel_lock_bridge(bridge_channel);
 	peer_chan = ast_bridge_peer_nolock(bridge_channel->bridge, bridge_channel->chan);
 	ast_bridge_unlock(bridge_channel->bridge);
@@ -412,7 +414,9 @@
 	RAII_VAR(struct ast_channel *, peer_chan, NULL, ast_channel_cleanup);
 	RAII_VAR(struct ast_features_general_config *, features_cfg, NULL, ao2_cleanup);
 
+	ast_channel_lock(bridge_channel->chan);
 	features_cfg = ast_get_chan_features_general_config(bridge_channel->chan);
+	ast_channel_unlock(bridge_channel->chan);
 	ast_bridge_channel_lock_bridge(bridge_channel);
 	peer_chan = ast_bridge_peer_nolock(bridge_channel->bridge, bridge_channel->chan);
 	ast_bridge_unlock(bridge_channel->bridge);




More information about the asterisk-commits mailing list