[asterisk-commits] alecdavis: branch 1.8 r287661 - /branches/1.8/main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 20 17:22:02 CDT 2010


Author: alecdavis
Date: Mon Sep 20 17:21:50 2010
New Revision: 287661

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=287661
Log:
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


Modified:
    branches/1.8/main/channel.c

Modified: branches/1.8/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/channel.c?view=diff&rev=287661&r1=287660&r2=287661
==============================================================================
--- branches/1.8/main/channel.c (original)
+++ branches/1.8/main/channel.c Mon Sep 20 17:21:50 2010
@@ -5984,9 +5984,6 @@
 	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);
 
@@ -6268,6 +6265,8 @@
 		ast_channel_unlock(original);
 		ao2_link(channels, original);
 	}
+
+	ao2_unlock(channels);
 
 	return 0;
 }




More information about the asterisk-commits mailing list