ast_framehook_attach() must be called with the channel locked.

The framehook container could become corrupted if the channel lock is not
held before calling.

Change-Id: I1a6b957a1f7b899eb29a186915f8cccab886a438
This commit is contained in:
Richard Mudgett
2016-08-22 15:01:37 -05:00
parent d2e03c252d
commit 5744f434f0
3 changed files with 14 additions and 7 deletions

View File

@@ -607,7 +607,10 @@ static void refer_blind_callback(struct ast_channel *chan, struct transfer_chann
ao2_ref(refer->progress, +1);
/* If we can't attach a frame hook for whatever reason send a notification of success immediately */
if ((refer->progress->framehook = ast_framehook_attach(chan, &hook)) < 0) {
ast_channel_lock(chan);
refer->progress->framehook = ast_framehook_attach(chan, &hook);
ast_channel_unlock(chan);
if (refer->progress->framehook < 0) {
struct refer_progress_notification *notification = refer_progress_notification_alloc(refer->progress, 200,
PJSIP_EVSUB_STATE_TERMINATED);