[Asterisk-code-review] ast framehook detach() must be called with the channel locked. (asterisk[13])
Richard Mudgett
asteriskteam at digium.com
Thu Aug 25 18:25:08 CDT 2016
Richard Mudgett has uploaded a new change for review.
https://gerrit.asterisk.org/3707
Change subject: ast_framehook_detach() must be called with the channel locked.
......................................................................
ast_framehook_detach() must be called with the channel locked.
The framehook container could become corrupted if the channel lock is not
held before calling.
Change-Id: If0a1c7ba0484ed3a191106a7516526b905952584
---
M res/res_fax.c
M res/res_pjsip_refer.c
2 files changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/07/3707/1
diff --git a/res/res_fax.c b/res/res_fax.c
index 86260d1..be88b58 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -4509,7 +4509,9 @@
ast_log(LOG_WARNING, "Attempt to attach a T.38 gateway on channel (%s) with gateway already running.\n", ast_channel_name(chan));
}
} else if (ast_false(val)) {
+ ast_channel_lock(chan);
ast_framehook_detach(chan, details->gateway_id);
+ ast_channel_unlock(chan);
details->gateway_id = -1;
} else {
ast_log(LOG_WARNING, "Unsupported value '%s' passed to FAXOPT(%s).\n", value, data);
@@ -4561,7 +4563,9 @@
ast_log(LOG_WARNING, "Attempt to attach a FAX detect on channel (%s) with FAX detect already running.\n", ast_channel_name(chan));
}
} else if (ast_false(val)) {
+ ast_channel_lock(chan);
ast_framehook_detach(chan, details->faxdetect_id);
+ ast_channel_unlock(chan);
details->faxdetect_id = -1;
} else {
ast_log(LOG_WARNING, "Unsupported value '%s' passed to FAXOPT(%s).\n", value, data);
diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c
index 23c377d..8fe4e84 100644
--- a/res/res_pjsip_refer.c
+++ b/res/res_pjsip_refer.c
@@ -641,7 +641,9 @@
refer_progress_notify(notification);
}
+ ast_channel_lock(chan);
ast_framehook_detach(chan, refer->progress->framehook);
+ ast_channel_unlock(chan);
ao2_cleanup(refer->progress);
}
--
To view, visit https://gerrit.asterisk.org/3707
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If0a1c7ba0484ed3a191106a7516526b905952584
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-code-review
mailing list