mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
asterisk: Audit locking of channel when manipulating flags.
When manipulating flags on a channel the channel has to be locked to guarantee that nothing else is also manipulating the flags. This change introduces locking where necessary to guarantee this. It also adds helper functions that manipulate channel flags and lock to reduce repeated code. ASTERISK-26789 Change-Id: I489280662dba0f4c50981bfc5b5a7073fef2db10
This commit is contained in:
@@ -4257,8 +4257,10 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
|
||||
ast_channel_pbx(c)->rtimeoutms = 10000;
|
||||
ast_channel_pbx(c)->dtimeoutms = 5000;
|
||||
|
||||
ast_channel_lock(c);
|
||||
autoloopflag = ast_test_flag(ast_channel_flags(c), AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
|
||||
ast_set_flag(ast_channel_flags(c), AST_FLAG_IN_AUTOLOOP);
|
||||
ast_channel_unlock(c);
|
||||
|
||||
if (ast_strlen_zero(ast_channel_exten(c))) {
|
||||
/* If not successful fall back to 's' - but only if there is no given exten */
|
||||
@@ -4503,8 +4505,10 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
|
||||
ast_pbx_hangup_handler_run(c);
|
||||
}
|
||||
|
||||
ast_channel_lock(c);
|
||||
ast_set2_flag(ast_channel_flags(c), autoloopflag, AST_FLAG_IN_AUTOLOOP);
|
||||
ast_clear_flag(ast_channel_flags(c), AST_FLAG_BRIDGE_HANGUP_RUN); /* from one round to the next, make sure this gets cleared */
|
||||
ast_channel_unlock(c);
|
||||
pbx_destroy(ast_channel_pbx(c));
|
||||
ast_channel_pbx_set(c, NULL);
|
||||
|
||||
|
Reference in New Issue
Block a user