Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
a58f15ee
Commit
a58f15ee
authored
8 years ago
by
zuul
Committed by
Gerrit Code Review
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge "chan_sip.c: Fix deadlock potential in fax redirection."
parents
ba2da66b
db4979fa
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
channels/chan_sip.c
+9
-7
9 additions, 7 deletions
channels/chan_sip.c
with
9 additions
and
7 deletions
channels/chan_sip.c
+
9
−
7
View file @
a58f15ee
...
@@ -8609,29 +8609,31 @@ static struct ast_frame *sip_read(struct ast_channel *ast)
...
@@ -8609,29 +8609,31 @@ static struct ast_frame *sip_read(struct ast_channel *ast)
if (faxdetected && ast_test_flag(&p->flags[1], SIP_PAGE2_FAX_DETECT_CNG)) {
if (faxdetected && ast_test_flag(&p->flags[1], SIP_PAGE2_FAX_DETECT_CNG)) {
if (strcmp(ast_channel_exten(ast), "fax")) {
if (strcmp(ast_channel_exten(ast), "fax")) {
const char *target_context = S_OR(ast_channel_macrocontext(ast), ast_channel_context(ast));
const char *target_context = S_OR(ast_channel_macrocontext(ast), ast_channel_context(ast));
/* We need to unlock 'ast' here because
/*
* We need to unlock 'ast' here because
* ast_exists_extension has the potential to start and
* ast_exists_extension has the potential to start and
* stop an autoservice on the channel. Such action is
* stop an autoservice on the channel. Such action is
* prone to deadlock if the channel is locked.
* prone to deadlock if the channel is locked.
*
* ast_async_goto() has its own restriction on not holding
* the channel lock.
*/
*/
sip_pvt_unlock(p);
sip_pvt_unlock(p);
ast_channel_unlock(ast);
ast_channel_unlock(ast);
ast_frfree(fr);
fr = &ast_null_frame;
if (ast_exists_extension(ast, target_context, "fax", 1,
if (ast_exists_extension(ast, target_context, "fax", 1,
S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, NULL))) {
S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, NULL))) {
ast_channel_lock(ast);
sip_pvt_lock(p);
ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", ast_channel_name(ast));
ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", ast_channel_name(ast));
pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast_channel_exten(ast));
pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast_channel_exten(ast));
if (ast_async_goto(ast, target_context, "fax", 1)) {
if (ast_async_goto(ast, target_context, "fax", 1)) {
ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(ast), target_context);
ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(ast), target_context);
}
}
ast_frfree(fr);
fr = &ast_null_frame;
} else {
} else {
ast_channel_lock(ast);
sip_pvt_lock(p);
ast_log(LOG_NOTICE, "FAX CNG detected but no fax extension\n");
ast_log(LOG_NOTICE, "FAX CNG detected but no fax extension\n");
}
}
ast_channel_lock(ast);
sip_pvt_lock(p);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment