channel locking: Add locking for channel snapshot creation
authorKevin Harwell <kharwell@digium.com>
Wed, 18 Dec 2013 20:33:37 +0000 (20:33 +0000)
committerKevin Harwell <kharwell@digium.com>
Wed, 18 Dec 2013 20:33:37 +0000 (20:33 +0000)
commit28c0cb28d0815e5e59ab99b60ac6b50e1ed9cbae
treeb42967f4899ba28aea79b9a11827c814b95b62c8
parent86b5e11607e2e3b7dcfb0b72d41b492ce868f31c
channel locking: Add locking for channel snapshot creation

Original commit message by mmichelson (asterisk 12 r403311):

"This adds channel locks around calls to create channel snapshots as well
as other functions which operate on a channel and then end up
creating a channel snapshot. Functions that expect the channel to be
locked prior to being called have had their documentation updated to
indicate such."

The above was initially committed and then reverted at r403398.  The problem
was found to be in core_local.c in the publish_local_bridge_message function.
The ast_unreal_lock_all function locks and adds a reference to the returned
channels and while they were being unlocked they were not being unreffed when
no longer needed.  Fixed by unreffing the channels.

Also in bridge.c a lock was obtained on "other->chan", but then an attempt was
made to unlock "other" and not the previously locked channel.  Fixed by
unlocking "other->chan"

(closes issue ASTERISK-22709)
Reported by: John Bigelow
........

Merged revisions 404237 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404260 65c4cc65-6c06-0410-ace0-fbb531ad65f3
53 files changed:
addons/chan_mobile.c
addons/chan_ooh323.c
apps/app_agent_pool.c
apps/app_confbridge.c
apps/app_dial.c
apps/app_disa.c
apps/app_meetme.c
apps/app_queue.c
apps/app_userevent.c
apps/app_voicemail.c
channels/chan_alsa.c
channels/chan_console.c
channels/chan_dahdi.c
channels/chan_gtalk.c
channels/chan_iax2.c
channels/chan_jingle.c
channels/chan_mgcp.c
channels/chan_misdn.c
channels/chan_motif.c
channels/chan_oss.c
channels/chan_phone.c
channels/chan_pjsip.c
channels/chan_skinny.c
channels/chan_unistim.c
channels/chan_vpb.cc
channels/sig_analog.c
channels/sig_pri.c
funcs/func_timeout.c
include/asterisk/aoc.h
include/asterisk/channel.h
include/asterisk/channelstate.h
include/asterisk/stasis_bridges.h
include/asterisk/stasis_channels.h
main/bridge.c
main/bridge_channel.c
main/cel.c
main/channel.c
main/core_local.c
main/dial.c
main/endpoints.c
main/pbx.c
main/pickup.c
main/stasis_bridges.c
main/stasis_channels.c
pbx/pbx_realtime.c
res/parking/parking_bridge_features.c
res/parking/parking_manager.c
res/res_agi.c
res/res_pjsip_refer.c
res/res_stasis.c
tests/test_cdr.c
tests/test_cel.c
tests/test_stasis_channels.c