summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-05-26 09:12:11 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-05-26 09:12:11 -0500
commitd4ccd3a6c088f4d2fefda1a44e4555dd54335cda (patch)
treea2cdff9821aa83e77dd8b0e3039e844ae0fe310f /res
parent5715360ba5606747f244421d63edb1cf06672381 (diff)
parent161820396495a549c9a378d32136cbb5f28ef2af (diff)
Merge "asterisk: Audit locking of channel when manipulating flags." into 13
Diffstat (limited to 'res')
-rw-r--r--res/res_agi.c4
-rw-r--r--res/res_musiconhold.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index e63ad992c..d7ea3510c 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -3144,12 +3144,14 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, const char
ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argc >= 3 ? argv[2] : "");
if ((app_to_exec = pbx_findapp(argv[1]))) {
+ ast_channel_lock(chan);
if (!(workaround = ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS))) {
ast_set_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS);
}
+ ast_channel_unlock(chan);
res = pbx_exec(chan, app_to_exec, argc == 2 ? "" : argv[2]);
if (!workaround) {
- ast_clear_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS);
+ ast_channel_clear_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS);
}
} else {
ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]);
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 9d6194170..c52c96428 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1548,8 +1548,10 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con
}
}
if (!res) {
+ ast_channel_lock(chan);
ast_channel_latest_musicclass_set(chan, mohclass->name);
ast_set_flag(ast_channel_flags(chan), AST_FLAG_MOH);
+ ast_channel_unlock(chan);
}
mohclass = mohclass_unref(mohclass, "unreffing local reference to mohclass in local_ast_moh_start");
@@ -1559,10 +1561,10 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con
static void local_ast_moh_stop(struct ast_channel *chan)
{
- ast_clear_flag(ast_channel_flags(chan), AST_FLAG_MOH);
ast_deactivate_generator(chan);
ast_channel_lock(chan);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_MOH);
if (ast_channel_music_state(chan)) {
if (ast_channel_stream(chan)) {
ast_closestream(ast_channel_stream(chan));