[asterisk-dev] [Code Review] 3067: channels: Return channel locked when allocating.

Matt Jordan reviewboard at asterisk.org
Mon Dec 16 20:38:42 CST 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3067/#review10431
-----------------------------------------------------------


My only other thought is that we really should limit this change to 12.

While theoretically this can occur in Asterisk 1.8/11, making this change effectively breaks every other channel driver that isn't in the Asterisk source tree. We should probably avoid doing that in a released branch. It's also highly unlikely to occur in almost every system out there - we ran into it only through some seriously aggressive use of channel redirect.

We should also probably put a \since 12.0.0 before the \note you've added that the channel is returned locked.

- Matt Jordan


On Dec. 12, 2013, 11:43 a.m., Joshua Colp wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3067/
> -----------------------------------------------------------
> 
> (Updated Dec. 12, 2013, 11:43 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> Currently when allocating a channel it is possible for external entities to become aware of the channel and try to interact with it before it is completely set up. This occurs because the channel is returned unlocked, and the caller allocating it is then expected to lock, populate it, and unlock. This leaves a small window where something else can get the channel.
> 
> The attached change makes it so ast_channel_alloc returns the allocated channel locked. It is expected that the caller then populates and unlocks. This leaves no window for something external to get and use it.
> 
> 
> Diffs
> -----
> 
>   /branches/12/tests/test_voicemail_api.c 403703 
>   /branches/12/tests/test_substitution.c 403703 
>   /branches/12/tests/test_stasis_channels.c 403703 
>   /branches/12/tests/test_cel.c 403703 
>   /branches/12/tests/test_cdr.c 403703 
>   /branches/12/tests/test_app.c 403703 
>   /branches/12/res/res_stasis_snoop.c 403703 
>   /branches/12/res/res_calendar.c 403703 
>   /branches/12/res/parking/parking_tests.c 403703 
>   /branches/12/main/pbx.c 403703 
>   /branches/12/main/message.c 403703 
>   /branches/12/main/core_unreal.c 403703 
>   /branches/12/main/channel.c 403703 
>   /branches/12/include/asterisk/channel.h 403703 
>   /branches/12/channels/chan_vpb.cc 403703 
>   /branches/12/channels/chan_unistim.c 403703 
>   /branches/12/channels/chan_skinny.c 403703 
>   /branches/12/channels/chan_sip.c 403703 
>   /branches/12/channels/chan_pjsip.c 403703 
>   /branches/12/channels/chan_phone.c 403703 
>   /branches/12/channels/chan_oss.c 403703 
>   /branches/12/channels/chan_nbs.c 403703 
>   /branches/12/channels/chan_multicast_rtp.c 403703 
>   /branches/12/channels/chan_motif.c 403703 
>   /branches/12/channels/chan_misdn.c 403703 
>   /branches/12/channels/chan_mgcp.c 403703 
>   /branches/12/channels/chan_jingle.c 403703 
>   /branches/12/channels/chan_iax2.c 403703 
>   /branches/12/channels/chan_h323.c 403703 
>   /branches/12/channels/chan_gtalk.c 403703 
>   /branches/12/channels/chan_dahdi.c 403703 
>   /branches/12/channels/chan_console.c 403703 
>   /branches/12/channels/chan_alsa.c 403703 
>   /branches/12/apps/confbridge/conf_chan_record.c 403703 
>   /branches/12/apps/app_voicemail.c 403703 
>   /branches/12/apps/app_meetme.c 403703 
>   /branches/12/addons/chan_ooh323.c 403703 
>   /branches/12/addons/chan_mobile.c 403703 
> 
> Diff: https://reviewboard.asterisk.org/r/3067/diff/
> 
> 
> Testing
> -------
> 
> Placed calls, ran tests, all work as expected.
> 
> 
> Thanks,
> 
> Joshua Colp
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20131217/7bbff930/attachment.html>


More information about the asterisk-dev mailing list