diff options
author | Richard Mudgett <rmudgett@digium.com> | 2016-06-30 15:17:02 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-06-30 15:31:20 -0500 |
commit | 640fbbbe2868779545aa8aef6b3f3fefdeb4eef5 (patch) | |
tree | 061c0dea88e873aded5f4fde333f9cead6b2a6f4 /main/features.c | |
parent | 77c49ac1a142b1665a986ed7354eb33c2279851b (diff) |
features: Fix channel datastore access.
Found as a result of the testsuite tests/callparking test crashing.
Several calls to ast_get_chan_featuremap_config() and
ast_get_chan_features_xfer_config() did not lock the channel before
calling so the channel's datastore list was accessed without the lock's
protection. Apparently another thread deleted a datastore on the
channel's list while the crashing thread was walking the list. Crash at
0xdeaddead due to MALLOC_DEBUG's memory filler value as a result.
* Add missing channel locks to calls that were not already protected
as the doxygen for those calls indicates.
Change-Id: Id273b3d305cc616406c353cbc841b2b7655efaa1
Diffstat (limited to 'main/features.c')
-rw-r--r-- | main/features.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/main/features.c b/main/features.c index b96cbd68c..00010514c 100644 --- a/main/features.c +++ b/main/features.c @@ -767,8 +767,8 @@ static int action_bridge(struct mansession *s, const struct message *m) astman_send_error(s, m, buf); return 0; } - xfer_cfg_a = ast_get_chan_features_xfer_config(chana); ast_channel_lock(chana); + xfer_cfg_a = ast_get_chan_features_xfer_config(chana); chana_exten = ast_strdupa(ast_channel_exten(chana)); chana_context = ast_strdupa(ast_channel_context(chana)); chana_priority = ast_channel_priority(chana); @@ -783,8 +783,8 @@ static int action_bridge(struct mansession *s, const struct message *m) astman_send_error(s, m, buf); return 0; } - xfer_cfg_b = ast_get_chan_features_xfer_config(chanb); ast_channel_lock(chanb); + xfer_cfg_b = ast_get_chan_features_xfer_config(chanb); chanb_exten = ast_strdupa(ast_channel_exten(chanb)); chanb_context = ast_strdupa(ast_channel_context(chanb)); chanb_priority = ast_channel_priority(chanb); @@ -1098,7 +1098,9 @@ static int bridge_exec(struct ast_channel *chan, const char *data) goto done; } + ast_channel_lock(current_dest_chan); xfer_cfg = ast_get_chan_features_xfer_config(current_dest_chan); + ast_channel_unlock(current_dest_chan); bridge_add_failed = ast_bridge_add_channel(bridge, current_dest_chan, peer_features, ast_test_flag(&opts, BRIDGE_OPT_PLAYTONE), xfer_cfg ? xfer_cfg->xfersound : NULL); |