aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralecdavis <alecdavis@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-20 22:21:50 +0000
committeralecdavis <alecdavis@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-20 22:21:50 +0000
commit6a0ebf4a7be54d89278bb7a94b4b856365c81931 (patch)
treec7764bdf2c4299d162e4fe863b235c3d81ee02b5
parent3f8eba54bde422a1fb0486ba8a299beca004ae0d (diff)
ast_do_masquerade. Keep channels ao2_container locked while unlink and linking channels.
Previously, Masquerade would unlock 'original' and 'clonechan' and allow another masq thread to run. End result would be corrupted memory, and the frequent report 'Bad Magic Number'. (closes issue #17801,#17710) Reported by: notthematrix Patches: Based on bug17801.diff1.txt uploaded by alecdavis (license 585) Tested by: alecdavis Review: https://reviewboard.asterisk.org/r/928 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@287661 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/channel.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/main/channel.c b/main/channel.c
index 9954d6613..7c6a98a90 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -5984,9 +5984,6 @@ int ast_do_masquerade(struct ast_channel *original)
ao2_unlink(channels, original);
ao2_unlink(channels, clonechan);
- /* now that both channels are locked and unlinked from the container, it is safe to unlock it */
- ao2_unlock(channels);
-
ast_debug(4, "Actually Masquerading %s(%d) into the structure of %s(%d)\n",
clonechan->name, clonechan->_state, original->name, original->_state);
@@ -6269,6 +6266,8 @@ done:
ao2_link(channels, original);
}
+ ao2_unlock(channels);
+
return 0;
}